CollectionsMarshal 類別

定義

不安全的類別,會提供一組方法,供存取集合的基礎資料表示。

public ref class CollectionsMarshal abstract sealed
public static class CollectionsMarshal
type CollectionsMarshal = class
Public Class CollectionsMarshal
繼承
CollectionsMarshal

方法

AsSpan<T>(List<T>)

取得清單中資料的 Span<T> 檢視。 當 Span<T> 正在使用時,不應對 List<T> 執行新增或移除項目。

GetValueRefOrAddDefault<TKey,TValue>(Dictionary<TKey,TValue>, TKey, Boolean)

取得指定字典中 之 TValue 的參考,如果索引鍵不存在,則加入具有預設值的新專案。

GetValueRefOrNullRef<TKey,TValue>(Dictionary<TKey,TValue>, TKey)

取得 中 的參考 TValue ,如果 不存在於 中, null 則取得 參考 dictionaryDictionary<TKey,TValue>

SetCount<T>(List<T>, Int32)

將 的 List<T> 計數設定為指定的值。

適用於