-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_EnumerableExtensions_ToHashSet__2
Andrew Koryavchenko edited this page Jun 17, 2018
·
5 revisions
Creates a HashSet(T) from an IEnumerable(T).
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
)
VB
<ExtensionAttribute>
Public Shared Function ToHashSet(Of T, TKey) (
source As IEnumerable(Of T),
keySelector As Func(Of T, TKey)
) As HashSet(Of TKey)
F#
[<ExtensionAttribute>]
static member ToHashSet :
source : IEnumerable<'T> *
keySelector : Func<'T, '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.
- 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