XEnumerableToHashSetTSource Method |
Note: This API is now obsolete.
Creates a hash set from the elements in the source sequence.
Namespace:
Linq.Extras
Assembly:
Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax[ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.ToHashSet instead")]
public static HashSet<TSource> ToHashSet<TSource>(
IEnumerable<TSource> source,
IEqualityComparer<TSource>? comparer = null
)
<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.ToHashSet instead")>
Public Shared Function ToHashSet(Of TSource) (
source As IEnumerable(Of TSource),
Optional comparer As IEqualityComparer(Of TSource) = Nothing
) As HashSet(Of TSource)
[<ObsoleteAttribute("This feature is now implemented directly in System.Linq. Please use Enumerable.ToHashSet instead")>]
static member ToHashSet :
source : IEnumerable<'TSource> *
?comparer : IEqualityComparer<'TSource>
(* Defaults:
let _comparer = defaultArg comparer null
*)
-> HashSet<'TSource>
Parameters
- source
- Type: System.Collections.GenericIEnumerableTSource
The sequence containing the elements to put in the hash set. - comparer (Optional)
- Type: System.Collections.GenericIEqualityComparerTSource
A comparer to test for equality between elements.
Type Parameters
- TSource
- The type of the elements of source.
Return Value
Type:
HashSetTSourceA hash set containing the same elements as the
source sequence.
RemarksSince a hash set cannot contain duplicates, duplicate elements from the source sequence will not be included in the hash set.
See Also