I have list, how can I get distinct values?
IList<string> words = new List<string> { "A", "b", "a" };
var distinctWords = words.Distinct(StringComparison.OrdinalIgnoreCase);
this gives me error: Distinct has some invalid arguments.
You need: StringComparer.OrdinalIgnoreCase
not StringComparison.OrdinalIgnoreCase
IList<string> words = new List<string> { "A", "b", "a" };
var distinctWords = words.Distinct(StringComparer.OrdinalIgnoreCase);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With