Compartir vía


CollectionsMarshal.GetValueRefOrNullRef<TKey,TValue> Método

Definición

Obtiene una referencia a en TValueDictionary<TKey,TValue> o una referencia null si no existe en .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

Parámetros de tipo

TKey

Tipo de una clave.

TValue

Tipo de un valor.

Parámetros

dictionary
Dictionary<TKey,TValue>

Diccionario del que se va a TValue obtener la referencia.

key
TKey

Clave usada para la búsqueda.

Devoluciones

TValue

Una referencia a en TValue o Dictionary<TKey,TValue> una referencia null si no existe en .dictionary

Comentarios

Los elementos no se deben agregar ni quitar de mientras Dictionary<TKey,TValue> la referencia TValue está en uso.

La referencia null se puede detectar llamando a System.Runtime.CompilerServices.Unsafe.IsNullRef<T>(T).

Se aplica a