Partager via


CollectionsMarshal.GetValueRefOrNullRef Méthode

Définition

Surcharges

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

Obtient une référence à un TValue dans ou Dictionary<TKey,TValue> une référence null si elle n’existe pas dans .dictionary

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

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);
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

Paramètres de type

TKey
TValue
TAlternateKey

Paramètres

key
TAlternateKey

Retours

TValue

S’applique à

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

Source:
CollectionsMarshal.cs
Source:
CollectionsMarshal.cs
Source:
CollectionsMarshal.cs

Obtient une référence à un TValue dans ou Dictionary<TKey,TValue> une référence null si elle n’existe pas dans .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

Paramètres de type

TKey

Type d’une clé.

TValue

Type d’une valeur.

Paramètres

dictionary
Dictionary<TKey,TValue>

Dictionnaire à partir duquel obtenir la référence TValue .

key
TKey

Clé utilisée pour la recherche.

Retours

TValue

Référence à un TValue dans ou Dictionary<TKey,TValue> une référence null s’il n’existe pas dans . dictionary.

Remarques

Les éléments ne doivent pas être ajoutés ou supprimés du Dictionary<TKey,TValue> pendant que la référence TValue est en cours d’utilisation.

La référence null peut être détectée en appelant System.Runtime.CompilerServices.Unsafe.IsNullRef<T>(T).

S’applique à