語言

CollectionsMarshal.GetValueRefOrNullRef 方法

定義

多載

名稱 Description
GetValueRefOrNullRef<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey)

在 中得到 a TValueDictionary<TKey,TValue> 的 參考,若 中不存在 dictionary則為 ref null。

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

會得到 a 的TValue參考Dictionary<TKey,TValue>,或如果 中不存在 null則得到 dictionary 參考。

GetValueRefOrNullRef<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey)

來源:
CollectionsMarshal.cs
來源:
CollectionsMarshal.cs
來源:
CollectionsMarshal.cs

在 中得到 a TValueDictionary<TKey,TValue> 的 參考,若 中不存在 dictionary則為 ref null。

public:
generic <typename TKey, typename TValue, typename TAlternateKey>
 static TValue % GetValueRefOrNullRef(System::Collections::Generic::Dictionary<TKey, TValue>::AlternateLookup<TAlternateKey> dictionary, TAlternateKey key);
public static ref TValue GetValueRefOrNullRef<TKey,TValue,TAlternateKey>(System.Collections.Generic.Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey> dictionary, TAlternateKey key) where TAlternateKey : allows ref struct;
static member GetValueRefOrNullRef : System.Collections.Generic.Dictionary<'Key, 'Value>.AlternateLookup<'AlternateKey> * 'AlternateKey -> 'Value
Public Shared Function GetValueRefOrNullRef(Of TKey, TValue, TAlternateKey) (dictionary As Dictionary(Of TKey, TValue).AlternateLookup(Of TAlternateKey), key As TAlternateKey) As TValue

類型參數

TKey

字典中索引鍵的類型。

TValue

字典中值的型別。

TAlternateKey

字典中查詢的替代鍵型。

參數

dictionary
Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>

字典可以從中取得參考 TValue 資料。

key
TAlternateKey

用於查詢的金鑰。

傳回

TValue

TValue在 中 Dictionary<TKey,TValue>null 或 若不存在dictionary於 ... 中即為 參考

備註

在參考資料使用期間,不應新增或移除Dictionary<TKey,TValue>TValue物品。

null可透過呼叫 IsNullRef<T>(T)來偵測 。

適用於

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

來源:
CollectionsMarshal.cs
來源:
CollectionsMarshal.cs
來源:
CollectionsMarshal.cs
來源:
CollectionsMarshal.cs
來源:
CollectionsMarshal.cs

會得到 a 的TValue參考Dictionary<TKey,TValue>,或如果 中不存在 null則得到 dictionary 參考。

public:
generic <typename TKey, typename TValue>
 static TValue % GetValueRefOrNullRef(System::Collections::Generic::Dictionary<TKey, TValue> ^ dictionary, TKey key);
public static ref TValue GetValueRefOrNullRef<TKey,TValue>(System.Collections.Generic.Dictionary<TKey,TValue> dictionary, TKey key);
static member GetValueRefOrNullRef : System.Collections.Generic.Dictionary<'Key, 'Value> * 'Key -> 'Value
Public Shared Function GetValueRefOrNullRef(Of TKey, TValue) (dictionary As Dictionary(Of TKey, TValue), key As TKey) As TValue

類型參數

TKey

鑰匙的種類。

TValue

值的類型。

參數

dictionary
Dictionary<TKey,TValue>

字典可以從中取得參考 TValue 資料。

key
TKey

用於查詢的金鑰。

傳回

TValue

TValue在 中 Dictionary<TKey,TValue>null 或 若不存在dictionary於 ... 中即為 參考

備註

在參考資料使用期間,不應新增或移除Dictionary<TKey,TValue>TValue物品。

null可透過呼叫 System.Runtime.CompilerServices.Unsafe.IsNullRef<T>(T)來偵測 。

適用於