Method ToHashSet
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ToHashSet<T>(IMappedQuery<T>, IEqualityComparer<T>?)
Reads every mapped row into a new HashSet<T>.
public static HashSet<T> ToHashSet<T>(this IMappedQuery<T> query, IEqualityComparer<T>? comparer = null)
Parameters
queryIMappedQuery<T>The query to execute.
comparerIEqualityComparer<T>The comparer for the rows, or null to use the default comparer.
Returns
- HashSet<T>
A set of the distinct rows. Rows that compare equal to an earlier row are dropped.
Type Parameters
TThe type each row is mapped to.
Remarks
All rows are buffered in memory before the call returns. Use Read(Action<IEnumerable<T>>) to process very large results as a stream.
- See Also
-
ToArray<T>(IMappedQuery<T>)