Something like IDictionary <TKey, TValue>, but only for keys (no value required) in .NET?
5 answers
You can use a class HashSet<T>, it is designed to store various values in a set.
The main difference between IDictionary{TKey, TValue}(except that it does not store values) is that you can add the same value for HashSet<T>, and if it already exists, it does not throw an exception (when you try to call a method, Addit, unlike the method AddonIDictionary{TKey, TValue} , which will throw ArgumentExceptionif the item already exists in the dictionary.
+11
, System.Collections.Generic.HashSet <T>
MSDN:
HashSet <T> . , .
HashSet <T> , . HashSet <T> .
.NET Framework 4, HashSet <T> ISet <T> .
+1