How to convert List<T> to HashSet<T> in C#? -
this question has answer here:
- convert array hashset<t> in .net 5 answers
i have list has duplicates of objects. solve that, need convert list hashset (in c#). know how?
make sure object's class overrides equals , gethashcode , can pass list<t> hashset<t> constructor. 
var hashset = new hashset<yourtype>(yourlist); you may see: what best algorithm overridden system.object.gethashcode?
Comments
Post a Comment