Reputation: 3554
I have a variable like below:
var dict = new Dictionary<string, HashSet<string>>();
I want to make sure the values in the HashSet are unique using StringComparer.Ordinal
. What would be the syntax for that? Thanks.
Upvotes: 0
Views: 63
Reputation: 5523
Everytime you initialize a new key, the value should be passed an explicit parameter like this:
dict["some key"] = new HashSet<string>(StringComparer.Ordinal);
Upvotes: 3