-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_EnumerableExtensions_ToHashSet__2_1
Andrew Koryavchenko edited this page Jun 17, 2018
·
5 revisions
EnumerableExtensions.ToHashSet(T, TKey) Method (IEnumerable(T), Func(T, TKey), IEqualityComparer(TKey))
Creates a HashSet(T) from an IEnumerable(T) with the specified equality comparer.
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static HashSet<TKey> ToHashSet<T, TKey>(
this IEnumerable<T> source,
Func<T, TKey> keySelector,
IEqualityComparer<TKey> comparer
)
VB
<ExtensionAttribute>
Public Shared Function ToHashSet(Of T, TKey) (
source As IEnumerable(Of T),
keySelector As Func(Of T, TKey),
comparer As IEqualityComparer(Of TKey)
) As HashSet(Of TKey)
F#
[<ExtensionAttribute>]
static member ToHashSet :
source : IEnumerable<'T> *
keySelector : Func<'T, 'TKey> *
comparer : IEqualityComparer<'TKey> -> HashSet<'TKey>
- source
- Type: System.Collections.Generic.IEnumerable(T)
The IEnumerable(T) to create a HashSet(T) from. - keySelector
- Type: System.Func(T, TKey)
A function to extract a key from each element. - comparer
- Type: System.Collections.Generic.IEqualityComparer(TKey)
The IEqualityComparer(T) implementation to use to comparing values in the set, ornull
to use the default implementation for the set type.
- T
- The type of the elements of source.
- TKey
- The type of the key returned by keySelector.
Type: HashSet(TKey)
A HashSet(T) that contains keys from the input sequence.
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
EnumerableExtensions Class
ToHashSet Overload
CodeJam.Collections Namespace