Which collection for storing unique strings?

后端 未结 3 893
猫巷女王i
猫巷女王i 2021-01-04 07:03

I\'m looking for a collection just like Dictionary(OF Key, Value) but I don\'t actually need a key and value. Key itself is enough. So something like Coll

相关标签:
3条回答
  • 2021-01-04 07:34

    HashSet<T> would work for this. It lets you store a unique set of values, without "abusing" a dictionary.

    0 讨论(0)
  • 2021-01-04 07:39

    List would be better than Collection as noted in this semi-duplicate question.

    A hashset in 3.5 would be better still. What version of .net are you using?

    0 讨论(0)
  • 2021-01-04 07:58

    I think what you want is a HashSet<T>.

    0 讨论(0)
提交回复
热议问题