List<string> strings = new string[] { "Hello", "Hello", "World" }.ToList();
strings = strings.Distinct().ToList();
Run Code Online (Sandbox Code Playgroud)
在.net 3.5中: -
var strings = new List<string> { "one", "two", "two", "three" };
var distinctStrings = strings.Distinct(); // IEnumerable<string>
var listDistinctStrings = distinctStrings.ToList(); // List<string>
Run Code Online (Sandbox Code Playgroud)
Boom shaka-laka!