How to retrieve actual item from HashSet?

前端 未结 11 561
花落未央
花落未央 2020-12-02 17:55

I\'ve read this question about why it is not possible, but haven\'t found a solution to the problem.

I would like to retrieve an item from a .NET HashSet. I

11条回答
  •  孤城傲影
    2020-12-02 18:34

    HashSet has a Contains(T) method.

    You can specify an IEqualityComparer if you need a custom comparison method (e.g., store a person object, but use the SSN for equality comparison).

提交回复
热议问题