ImmutableDictionary.ToImmutableDictionary Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
|
ToImmutableDictionary |
Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents. |
|
ToImmutableDictionary |
Creates an immutable dictionary from the current contents of the builder's dictionary. |
|
ToImmutableDictionary |
Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents by using the specified key comparer. |
|
ToImmutableDictionary |
Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents by using the specified key and value comparers. |
|
ToImmutableDictionary |
Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key comparer. |
|
ToImmutableDictionary |
Enumerates and transforms a sequence, and produces an immutable dictionary of its contents. |
|
ToImmutableDictionary |
Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key and value comparers. |
|
ToImmutableDictionary |
Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys. |
|
ToImmutableDictionary |
Constructs an immutable dictionary based on some transformation of a sequence. |
ToImmutableDictionary(IEnumerable>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable> ^ source);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable> source);
static member ToImmutableDictionary : seq> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue))) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TKey
The type of the keys in the dictionary.
- TValue
The type of the values in the dictionary.
Parameters
- source
-
IEnumerable<KeyValuePair
>
The sequence of key/value pairs to enumerate.
Returns
An immutable dictionary that contains the key/value pairs in the specified sequence.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(ImmutableDictionary.Builder)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Creates an immutable dictionary from the current contents of the builder's dictionary.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Immutable::ImmutableDictionary::Builder ^ builder);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Immutable.ImmutableDictionary.Builder builder);
static member ToImmutableDictionary : System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>.Builder -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TKey, TValue) (builder As ImmutableDictionary(Of TKey, TValue).Builder) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TKey
The type of the keys in the dictionary.
- TValue
The type of the values in the dictionary.
Parameters
- builder
-
ImmutableDictionary
.Builder
The builder to create the immutable dictionary from.
Returns
An immutable dictionary that contains the current contents in the builder's dictionary.
Applies to
ToImmutableDictionary(IEnumerable>, IEqualityComparer)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents by using the specified key comparer.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable> ^ source, System::Collections::Generic::IEqualityComparer ^ keyComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable> source, System.Collections.Generic.IEqualityComparer keyComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable> source, System.Collections.Generic.IEqualityComparer? keyComparer);
static member ToImmutableDictionary : seq> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue)), keyComparer As IEqualityComparer(Of TKey)) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TKey
The type of the keys in the dictionary.
- TValue
The type of the values in the dictionary.
Parameters
- source
-
IEnumerable<KeyValuePair
>
The sequence of key/value pairs to enumerate.
- keyComparer
-
IEqualityComparer
The key comparer to use when building the immutable dictionary.
Returns
An immutable dictionary that contains the key/value pairs in the specified sequence.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(IEnumerable>, IEqualityComparer, IEqualityComparer)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Enumerates a sequence of key/value pairs and produces an immutable dictionary of its contents by using the specified key and value comparers.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable> ^ source, System::Collections::Generic::IEqualityComparer ^ keyComparer, System::Collections::Generic::IEqualityComparer ^ valueComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable> source, System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable> source, System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer);
static member ToImmutableDictionary : seq> * System.Collections.Generic.IEqualityComparer<'Key> * System.Collections.Generic.IEqualityComparer<'Value> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue)), keyComparer As IEqualityComparer(Of TKey), valueComparer As IEqualityComparer(Of TValue)) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TKey
The type of the keys in the dictionary.
- TValue
The type of the values in the dictionary.
Parameters
- source
-
IEnumerable<KeyValuePair
>
The sequence of key/value pairs to enumerate.
- keyComparer
-
IEqualityComparer
The key comparer to use when building the immutable dictionary.
- valueComparer
-
IEqualityComparer
The value comparer to use for the immutable dictionary.
Returns
An immutable dictionary that contains the key/value pairs in the specified sequence.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(IEnumerable, Func, Func, IEqualityComparer)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key comparer.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable ^ source, Func ^ keySelector, Func ^ elementSelector, System::Collections::Generic::IEqualityComparer ^ keyComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, Func elementSelector, System.Collections.Generic.IEqualityComparer keyComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, Func elementSelector, System.Collections.Generic.IEqualityComparer? keyComparer);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Value> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TSource, TKey, TValue) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TValue), keyComparer As IEqualityComparer(Of TKey)) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TSource
The type of the elements in the sequence.
- TKey
The type of the keys in the resulting dictionary.
- TValue
The type of the values in the resulting dictionary.
Parameters
- source
-
IEnumerable
The sequence to enumerate to generate the dictionary.
- keySelector
-
Func
The function that will produce the key for the dictionary from each sequence element.
- elementSelector
-
Func
The function that will produce the value for the dictionary from each sequence element.
- keyComparer
-
IEqualityComparer
The key comparer to use for the dictionary.
Returns
An immutable dictionary that contains the items in the specified sequence.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(IEnumerable, Func, Func)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Enumerates and transforms a sequence, and produces an immutable dictionary of its contents.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable ^ source, Func ^ keySelector, Func ^ elementSelector);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, Func elementSelector);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Value> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TSource, TKey, TValue) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TValue)) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TSource
The type of the elements in the sequence.
- TKey
The type of the keys in the resulting dictionary.
- TValue
The type of the values in the resulting dictionary.
Parameters
- source
-
IEnumerable
The sequence to enumerate to generate the dictionary.
- keySelector
-
Func
The function that will produce the key for the dictionary from each sequence element.
- elementSelector
-
Func
The function that will produce the value for the dictionary from each sequence element.
Returns
An immutable dictionary that contains the items in the specified sequence.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(IEnumerable,
Func, Func, IEqualityComparer,
IEqualityComparer)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Enumerates and transforms a sequence, and produces an immutable dictionary of its contents by using the specified key and value comparers.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable ^ source, Func ^ keySelector, Func ^ elementSelector, System::Collections::Generic::IEqualityComparer ^ keyComparer, System::Collections::Generic::IEqualityComparer ^ valueComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, Func elementSelector, System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, Func elementSelector, System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Value> * System.Collections.Generic.IEqualityComparer<'Key> * System.Collections.Generic.IEqualityComparer<'Value> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
Public Function ToImmutableDictionary(Of TSource, TKey, TValue) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TValue), keyComparer As IEqualityComparer(Of TKey), valueComparer As IEqualityComparer(Of TValue)) As ImmutableDictionary(Of TKey, TValue)
Type Parameters
- TSource
The type of the elements in the sequence.
- TKey
The type of the keys in the resulting dictionary.
- TValue
The type of the values in the resulting dictionary.
Parameters
- source
-
IEnumerable
The sequence to enumerate to generate the dictionary.
- keySelector
-
Func
The function that will produce the key for the dictionary from each sequence element.
- elementSelector
-
Func
The function that will produce the value for the dictionary from each sequence element.
- keyComparer
-
IEqualityComparer
The key comparer to use for the dictionary.
- valueComparer
-
IEqualityComparer
The value comparer to use for the dictionary.
Returns
An immutable dictionary that contains the items in the specified sequence.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(IEnumerable, Func)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Constructs an immutable dictionary from an existing collection of elements, applying a transformation function to the source keys.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable ^ source, Func ^ keySelector);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Source>
Public Function ToImmutableDictionary(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey)) As ImmutableDictionary(Of TKey, TSource)
Type Parameters
- TSource
The type of element in the source collection.
- TKey
The type of key in the resulting immutable dictionary.
Parameters
- source
-
IEnumerable
The source collection used to generate the immutable dictionary.
- keySelector
-
Func
The function used to transform keys for the immutable dictionary.
Returns
The immutable dictionary that contains elements from source, with keys transformed by applying keySelector.
Exceptions
An element with the same key but a different value already exists in the dictionary.
Applies to
ToImmutableDictionary(IEnumerable, Func, IEqualityComparer)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
Constructs an immutable dictionary based on some transformation of a sequence.
public:
generic
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable ^ source, Func ^ keySelector, System::Collections::Generic::IEqualityComparer ^ keyComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, System.Collections.Generic.IEqualityComparer keyComparer);
public static System.Collections.Immutable.ImmutableDictionary ToImmutableDictionary(this System.Collections.Generic.IEnumerable source, Func keySelector, System.Collections.Generic.IEqualityComparer? keyComparer);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Source>
Public Function ToImmutableDictionary(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), keyComparer As IEqualityComparer(Of TKey)) As ImmutableDictionary(Of TKey, TSource)
Type Parameters
- TSource
The type of element in the source collection.
- TKey
The type of key in the resulting immutable dictionary.
Parameters
- source
-
IEnumerable
The source collection used to generate the immutable dictionary.
- keySelector
-
Func
The function used to transform keys for the immutable dictionary.
- keyComparer
-
IEqualityComparer
The key comparer to use for the dictionary.
Returns
The immutable dictionary that contains elements from source, with keys transformed by applying keySelector.
Exceptions
An element with the same key but a different value already exists in the dictionary.