When should I use the HashSet type?

前端 未结 11 1051
温柔的废话
温柔的废话 2020-11-28 02:21

I am exploring the HashSet type, but I don\'t understand where it stands in collections.

Can one use it to replace a List

11条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 02:55

    In short - anytime you are tempted to use a Dictionary (or a Dictionary where S is a property of T) then you should consider a HashSet (or HashSet + implementing IEquatable on T which equates on S)

提交回复
热议问题