CollectionsMarshal.GetValueRefOrAddDefault Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Sobrecargas
| Name | Description |
|---|---|
| GetValueRefOrAddDefault<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey, Boolean) |
Obtém uma referência para a |
| GetValueRefOrAddDefault<TKey,TValue>(Dictionary<TKey,TValue>, TKey, Boolean) |
Recebe uma referência a |
GetValueRefOrAddDefault<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey, Boolean)
- Origem:
- CollectionsMarshal.cs
- Origem:
- CollectionsMarshal.cs
- Origem:
- CollectionsMarshal.cs
Obtém uma referência para a TValue no Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, adicionando uma nova entrada com um valor padrão se este não existir no dictionary.
public:
generic <typename TKey, typename TValue, typename TAlternateKey>
static TValue % GetValueRefOrAddDefault(System::Collections::Generic::Dictionary<TKey, TValue>::AlternateLookup<TAlternateKey> dictionary, TAlternateKey key, [Runtime::InteropServices::Out] bool % exists);
public static ref TValue? GetValueRefOrAddDefault<TKey,TValue,TAlternateKey>(System.Collections.Generic.Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey> dictionary, TAlternateKey key, out bool exists) where TAlternateKey : allows ref struct;
static member GetValueRefOrAddDefault : System.Collections.Generic.Dictionary<'Key, 'Value>.AlternateLookup<'AlternateKey> * 'AlternateKey * bool -> 'Value
Public Shared Function GetValueRefOrAddDefault(Of TKey, TValue, TAlternateKey) (dictionary As Dictionary(Of TKey, TValue).AlternateLookup(Of TAlternateKey), key As TAlternateKey, ByRef exists As Boolean) As TValue
Parâmetros de Tipo Genérico
- TKey
O tipo das chaves no dicionário.
- TValue
O tipo dos valores no dicionário.
- TAlternateKey
O tipo da chave alternativa na consulta do dicionário.
Parâmetros
O dicionário para obter a referência TValue .
- key
- TAlternateKey
A chave usada para a pesquisa.
- exists
- Boolean
Se uma nova entrada para a chave dada foi ou não adicionada ao dicionário.
Devoluções
Uma referência a um TValue no especificado Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>.
Observações
Itens não devem ser adicionados ou removidos Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey> enquanto a referência TValue estiver em uso.
Aplica-se a
GetValueRefOrAddDefault<TKey,TValue>(Dictionary<TKey,TValue>, TKey, Boolean)
- Origem:
- CollectionsMarshal.cs
- Origem:
- CollectionsMarshal.cs
- Origem:
- CollectionsMarshal.cs
- Origem:
- CollectionsMarshal.cs
- Origem:
- CollectionsMarshal.cs
Recebe uma referência a TValue no dicionário especificado, adicionando uma nova entrada com um valor padrão caso a chave não exista.
public:
generic <typename TKey, typename TValue>
static TValue % GetValueRefOrAddDefault(System::Collections::Generic::Dictionary<TKey, TValue> ^ dictionary, TKey key, [Runtime::InteropServices::Out] bool % exists);
public static ref TValue? GetValueRefOrAddDefault<TKey,TValue>(System.Collections.Generic.Dictionary<TKey,TValue> dictionary, TKey key, out bool exists);
static member GetValueRefOrAddDefault : System.Collections.Generic.Dictionary<'Key, 'Value> * 'Key * bool -> 'Value
Public Shared Function GetValueRefOrAddDefault(Of TKey, TValue) (dictionary As Dictionary(Of TKey, TValue), key As TKey, ByRef exists As Boolean) As TValue
Parâmetros de Tipo Genérico
- TKey
O tipo de chave.
- TValue
O tipo de valor.
Parâmetros
- dictionary
- Dictionary<TKey,TValue>
O dicionário para obter a referência TValue .
- key
- TKey
A chave usada para a pesquisa.
- exists
- Boolean
Quando este método retorna, contém true se key já existia no dicionário, e false se uma nova entrada foi adicionada.
Devoluções
Uma referência a a TValue no dicionário especificado.
Observações
Itens não devem ser adicionados ou removidos Dictionary<TKey,TValue> enquanto a referência TValue estiver em uso.