ImmutableDictionary.ToImmutableDictionary 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ToImmutableDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
枚举键/值对的序列,并生成其内容的不可变字典。
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ source);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TKey,TValue> (this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source);
static member ToImmutableDictionary : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
<Extension()>
Public Function ToImmutableDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue))) As ImmutableDictionary(Of TKey, TValue)
类型参数
- TKey
字典中的键的类型。
- TValue
字典中的值的类型。
参数
- source
- IEnumerable<KeyValuePair<TKey,TValue>>
要枚举的键/值对的序列。
返回
一个不可变字典,其中包含指定序列中的键/值对。
适用于
ToImmutableDictionary<TKey,TValue>(ImmutableDictionary<TKey,TValue>.Builder)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
从生成器字典的当前内容创建不可变字典。
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Immutable::ImmutableDictionary<TKey, TValue>::Builder ^ builder);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TKey,TValue> (this System.Collections.Immutable.ImmutableDictionary<TKey,TValue>.Builder builder);
static member ToImmutableDictionary : System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>.Builder -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
<Extension()>
Public Function ToImmutableDictionary(Of TKey, TValue) (builder As ImmutableDictionary(Of TKey, TValue).Builder) As ImmutableDictionary(Of TKey, TValue)
类型参数
- TKey
字典中的键的类型。
- TValue
字典中的值的类型。
参数
要从中创建不可变字典的生成器。
返回
包含生成器字典中当前内容的不可变字典。
适用于
ToImmutableDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
枚举键/值对的序列,并使用指定的键比较器生成其内容的不可变字典。
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ source, System::Collections::Generic::IEqualityComparer<TKey> ^ keyComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TKey,TValue> (this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey> keyComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TKey,TValue> (this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer);
static member ToImmutableDictionary : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
<Extension()>
Public Function ToImmutableDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue)), keyComparer As IEqualityComparer(Of TKey)) As ImmutableDictionary(Of TKey, TValue)
类型参数
- TKey
字典中的键的类型。
- TValue
字典中的值的类型。
参数
- source
- IEnumerable<KeyValuePair<TKey,TValue>>
要枚举的键/值对的序列。
- keyComparer
- IEqualityComparer<TKey>
生成不可变字典时要使用的键比较器。
返回
一个不可变字典,其中包含指定序列中的键/值对。
适用于
ToImmutableDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
枚举键/值对的序列,并使用指定的键和值比较器生成其内容的不可变字典。
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ source, System::Collections::Generic::IEqualityComparer<TKey> ^ keyComparer, System::Collections::Generic::IEqualityComparer<TValue> ^ valueComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TKey,TValue> (this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey> keyComparer, System.Collections.Generic.IEqualityComparer<TValue> valueComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TKey,TValue> (this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer, System.Collections.Generic.IEqualityComparer<TValue>? valueComparer);
static member ToImmutableDictionary : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> * System.Collections.Generic.IEqualityComparer<'Value> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
<Extension()>
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)
类型参数
- TKey
字典中的键的类型。
- TValue
字典中的值的类型。
参数
- source
- IEnumerable<KeyValuePair<TKey,TValue>>
要枚举的键/值对的序列。
- keyComparer
- IEqualityComparer<TKey>
生成不可变字典时要使用的键比较器。
- valueComparer
- IEqualityComparer<TValue>
用于不可变字典的值比较器。
返回
一个不可变字典,其中包含指定序列中的键/值对。
适用于
ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
枚举并转换序列,然后生成其内容的不可变字典。
public:
generic <typename TSource, typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TSource, TValue> ^ elementSelector);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TSource,TKey,TValue> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TValue> elementSelector);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Value> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
<Extension()>
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)
类型参数
- TSource
序列中元素的类型。
- TKey
生成的字典中键的类型。
- TValue
生成的字典中值的类型。
参数
- source
- IEnumerable<TSource>
为生成字典而要枚举的序列。
- keySelector
- Func<TSource,TKey>
用于从每个序列元素生成字典键的函数。
- elementSelector
- Func<TSource,TValue>
用于从每个序列元素生成字典值的函数。
返回
一个不可变字典,其中包含指定序列中的项。
适用于
ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
枚举并转换序列,然后使用指定的键比较器生成其内容的不可变字典。
public:
generic <typename TSource, typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TSource, TValue> ^ elementSelector, System::Collections::Generic::IEqualityComparer<TKey> ^ keyComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TSource,TKey,TValue> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TValue> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> keyComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TSource,TKey,TValue> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TValue> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Value> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Value>
<Extension()>
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)
类型参数
- TSource
序列中元素的类型。
- TKey
生成的字典中键的类型。
- TValue
生成的字典中值的类型。
参数
- source
- IEnumerable<TSource>
为生成字典而要枚举的序列。
- keySelector
- Func<TSource,TKey>
用于从每个序列元素生成字典键的函数。
- elementSelector
- Func<TSource,TValue>
用于从每个序列元素生成字典值的函数。
- keyComparer
- IEqualityComparer<TKey>
用于字典的键比较器。
返回
一个不可变字典,其中包含指定序列中的项。
适用于
ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
枚举并转换序列,然后使用指定的键和值比较器生成其内容的不可变字典。
public:
generic <typename TSource, typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TSource, TValue> ^ elementSelector, System::Collections::Generic::IEqualityComparer<TKey> ^ keyComparer, System::Collections::Generic::IEqualityComparer<TValue> ^ valueComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TSource,TKey,TValue> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TValue> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> keyComparer, System.Collections.Generic.IEqualityComparer<TValue> valueComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TValue> ToImmutableDictionary<TSource,TKey,TValue> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TValue> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer, System.Collections.Generic.IEqualityComparer<TValue>? 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>
<Extension()>
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)
类型参数
- TSource
序列中元素的类型。
- TKey
生成的字典中键的类型。
- TValue
生成的字典中值的类型。
参数
- source
- IEnumerable<TSource>
为生成字典而要枚举的序列。
- keySelector
- Func<TSource,TKey>
用于从每个序列元素生成字典键的函数。
- elementSelector
- Func<TSource,TValue>
用于从每个序列元素生成字典值的函数。
- keyComparer
- IEqualityComparer<TKey>
用于字典的键比较器。
- valueComparer
- IEqualityComparer<TValue>
用于字典的值比较器。
返回
一个不可变字典,其中包含指定序列中的项。
适用于
ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
通过向源键应用转换函数,从现有元素集合构造一个不可变字典。
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TSource> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TSource> ToImmutableDictionary<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Source>
<Extension()>
Public Function ToImmutableDictionary(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey)) As ImmutableDictionary(Of TKey, TSource)
类型参数
- TSource
源集合中元素的类型。
- TKey
生成的不可变字典中键的类型。
参数
- source
- IEnumerable<TSource>
用于生成不可变字典的源集合。
- keySelector
- Func<TSource,TKey>
用于转换不可变字典键的函数。
返回
包含 source
中的元素的不可变字典,其键已通过应用 keySelector
进行转换。
适用于
ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
- Source:
- ImmutableDictionary.cs
基于对序列进行某种形式的转换来构造一个不可变字典。
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Immutable::ImmutableDictionary<TKey, TSource> ^ ToImmutableDictionary(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector, System::Collections::Generic::IEqualityComparer<TKey> ^ keyComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TSource> ToImmutableDictionary<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> keyComparer);
public static System.Collections.Immutable.ImmutableDictionary<TKey,TSource> ToImmutableDictionary<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? keyComparer);
static member ToImmutableDictionary : seq<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Immutable.ImmutableDictionary<'Key, 'Source>
<Extension()>
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)
类型参数
- TSource
源集合中元素的类型。
- TKey
生成的不可变字典中键的类型。
参数
- source
- IEnumerable<TSource>
用于生成不可变字典的源集合。
- keySelector
- Func<TSource,TKey>
用于转换不可变字典键的函数。
- keyComparer
- IEqualityComparer<TKey>
用于字典的键比较器。
返回
包含 source
中的元素的不可变字典,其键已通过应用 keySelector
进行转换。