語言

CollectionExtensions 類別

定義

提供通用集合的擴充方法。

public ref class CollectionExtensions abstract sealed
public static class CollectionExtensions
type CollectionExtensions = class
Public Module CollectionExtensions
繼承
CollectionExtensions

方法

名稱 Description
AddRange<T>(List<T>, ReadOnlySpan<T>)

將指定張展的元素加到末 List<T>尾。

AsReadOnly<T>(IList<T>)

回傳指定清單的唯讀 ReadOnlyCollection<T> 包裝器。

AsReadOnly<T>(ISet<T>)

回傳指定集合的唯讀 ReadOnlySet<T> 包裝器。

AsReadOnly<TKey,TValue>(IDictionary<TKey,TValue>)

回傳一個唯讀 ReadOnlyDictionary<TKey,TValue> 包裝器,針對目前字典。

CopyTo<T>(List<T>, Span<T>)

整個 List<T> 複製到一個跨度。

GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue)

嘗試取得與指定 key 值 dictionary相關的值。

GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey)

嘗試取得與指定 key 值 dictionary相關的值。

InsertRange<T>(List<T>, Int32, ReadOnlySpan<T>)

將張成的元素插入 List<T> 到指定的索引中。

Remove<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)

嘗試從 中移除指定keydictionary值。

TryAdd<TKey,TValue>(IDictionary<TKey,TValue>, TKey, TValue)

嘗試將指定的 key 和 value 加入 dictionary。

適用於