How to convert linq results to HashSet or HashedSet

I have a property on a class that is an ISet. I’m trying to get the results of a linq query into that property, but can’t figure out how to do so.

Basically, looking for the last part of this:

ISet<T> foo = new HashedSet<T>();
foo = (from x in bar.Items select x).SOMETHING;

Could also do this:

HashSet<T> foo = new HashSet<T>();
foo = (from x in bar.Items select x).SOMETHING;

9 Answers
9

Leave a Comment