Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (23 sloc) 724 Bytes

MA0002 - Use an overload that has a IEqualityComparer<string> parameter

You should be explicit in the way string must be compared in HashSet<string>, Dictionary<string, TValue> or ConcurrentDictionary<string, TValue> or any methods that manipulate strings.

new HashSet<string>()

// Should be
new HashSet<string>(StringComparer.Ordinal)
new Dictionary<string, int>()

// Should be
new Dictionary<string, int>(StringComparer.Ordinal)
new ConcurrentDictionary<string, int>()

// Should be
new ConcurrentDictionary<string, int>(StringComparer.Ordinal)
IEnumerable<string> list;
list.Distinct();

// Should be
list.Distinct(StringComparer.Ordinal);
You can’t perform that action at this time.