List with excellent and StringComparison.OrdinalIgnoreCase

I have a list, how can I get various values?

IList<string> words = new List<string> { "A", "b", "a" }; var distinctWords = words.Distinct(StringComparison.OrdinalIgnoreCase); 

this gives me an error: Distinct has some invalid arguments.

+6
source share
1 answer

You need: StringComparer.OrdinalIgnoreCase not StringComparison.OrdinalIgnoreCase

 IList<string> words = new List<string> { "A", "b", "a" }; var distinctWords = words.Distinct(StringComparer.OrdinalIgnoreCase); 
+11
source

All Articles