Returns a HashSet<(Of <(<'T>)>)> of the source items using the specified equality
comparer for the type.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public static HashSet<TSource> ToHashSet<TSource>( this IEnumerable<TSource> source, IEqualityComparer<TSource> comparer )
<ExtensionAttribute> _ Public Shared Function ToHashSet(Of TSource) ( _ source As IEnumerable(Of TSource), _ comparer As IEqualityComparer(Of TSource) _ ) As HashSet(Of TSource)
public: [ExtensionAttribute] generic<typename TSource> static HashSet<TSource>^ ToHashSet( IEnumerable<TSource>^ source, IEqualityComparer<TSource>^ comparer )
Generic Template Parameters
- TSource
[Missing <typeparam name="TSource"/> documentation for "M:MoreLinq.MoreEnumerable.ToHashSet``1(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEqualityComparer{``0})"]
Parameters
- source (IEnumerable<(Of <(<'TSource>)>)>)
- Source sequence
- comparer (IEqualityComparer<(Of <(<'TSource>)>)>)
- Equality comparer to use; a value of null will cause the type's default equality comparer to be used
Return Value
A hash set of the items in the sequence, using the default equality comparer.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<(Of <(<'TSource>)>)>. When you use instance method syntax to call this method, omit the first parameter.
Remarks
This evaluates the input sequence completely.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | source is null |
Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)