CollectionsMarshal.GetValueRefOrNullRef 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| GetValueRefOrNullRef<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey) |
在 中得到 a |
| GetValueRefOrNullRef<TKey,TValue>(Dictionary<TKey,TValue>, TKey) |
會得到 a 的 |
GetValueRefOrNullRef<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey)
在 中得到 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
字典中查詢的替代鍵型。
參數
字典可以從中取得參考 TValue 資料。
- key
- TAlternateKey
用於查詢的金鑰。
傳回
TValue在 中 Dictionary<TKey,TValue>null 或 若不存在dictionary於 ... 中即為 參考
備註
在參考資料使用期間,不應新增或移除Dictionary<TKey,TValue>TValue物品。
null可透過呼叫 IsNullRef<T>(T)來偵測 。
適用於
GetValueRefOrNullRef<TKey,TValue>(Dictionary<TKey,TValue>, TKey)
會得到 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在 中 Dictionary<TKey,TValue>null 或 若不存在dictionary於 ... 中即為 參考
備註
在參考資料使用期間,不應新增或移除Dictionary<TKey,TValue>TValue物品。
null可透過呼叫 System.Runtime.CompilerServices.Unsafe.IsNullRef<T>(T)來偵測 。