FrozenDictionary.ToFrozenDictionary 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ToFrozenDictionary<TKey,TValue>(IEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>)
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
使用指定的键/值对创建一个 FrozenDictionary<TKey,TValue> 。
public static System.Collections.Frozen.FrozenDictionary<TKey,TValue> ToFrozenDictionary<TKey,TValue>(this System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member ToFrozenDictionary : seq<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Value>
<Extension()>
Public Function ToFrozenDictionary(Of TKey, TValue) (source As IEnumerable(Of KeyValuePair(Of TKey, TValue)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As FrozenDictionary(Of TKey, TValue)
类型参数
- TKey
字典中键的类型。
- TValue
字典中值的类型。
参数
- source
- IEnumerable<KeyValuePair<TKey,TValue>>
用于填充字典的键/值对。
- comparer
- IEqualityComparer<TKey>
用于比较键相等性的比较器实现。 如果为 null,则使用 Default。
返回
一个 FrozenDictionary<TKey,TValue> 包含指定键和值的键。
注解
如果输入中多次出现同一键,序列中的最后一个键优先。 这与 ToDictionary重复键导致异常的情况不同。
适用于
ToFrozenDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
根据指定的键选择器和元素选择器函数从 FrozenDictionary<TKey,TValue> 创建 IEnumerable<T>。
public static System.Collections.Frozen.FrozenDictionary<TKey,TElement> ToFrozenDictionary<TSource,TKey,TElement>(this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member ToFrozenDictionary : seq<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Element>
<Extension()>
Public Function ToFrozenDictionary(Of TSource, TKey, TElement) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As FrozenDictionary(Of TKey, TElement)
类型参数
- TSource
的元素 source的类型。
- TKey
返回 keySelector的键的类型。
- TElement
返回 elementSelector的值的类型。
参数
- source
- IEnumerable<TSource>
- keySelector
- Func<TSource,TKey>
用于从每个元素中提取键的函数。
- elementSelector
- Func<TSource,TElement>
一个转换函数,用于从每个元素生成结果元素值。
- comparer
- IEqualityComparer<TKey>
要比较键的一个 IEqualityComparer<T> 。
返回
一个 FrozenDictionary<TKey,TValue> ,其中包含从输入序列中选择的键和值。
适用于
ToFrozenDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
- Source:
- FrozenDictionary.cs
根据指定的键选择器函数创建一个FrozenDictionary<TKey,TValue>IEnumerable<T>。
public static System.Collections.Frozen.FrozenDictionary<TKey,TSource> ToFrozenDictionary<TSource,TKey>(this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member ToFrozenDictionary : seq<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Frozen.FrozenDictionary<'Key, 'Source>
<Extension()>
Public Function ToFrozenDictionary(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As FrozenDictionary(Of TKey, TSource)
类型参数
- TSource
的元素 source的类型。
- TKey
返回 keySelector的键的类型。
参数
- source
- IEnumerable<TSource>
- keySelector
- Func<TSource,TKey>
用于从每个元素中提取键的函数。
- comparer
- IEqualityComparer<TKey>
要比较键的一个 IEqualityComparer<T> 。
返回
一个 FrozenDictionary<TKey,TValue> ,其中包含从输入序列中选择的键和值。