CollectionsMarshal.GetValueRefOrAddDefault Metod

Definition

Överlagringar

Name Description
GetValueRefOrAddDefault<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey, Boolean)

Hämtar en referens till en TValue i Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, och lägger till en ny post med ett standardvärde om den inte finns i dictionary.

GetValueRefOrAddDefault<TKey,TValue>(Dictionary<TKey,TValue>, TKey, Boolean)

Hämtar en referens till en TValue i den angivna ordlistan och lägger till en ny post med ett standardvärde om nyckeln inte finns.

GetValueRefOrAddDefault<TKey,TValue,TAlternateKey>(Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, TAlternateKey, Boolean)

Källa:
CollectionsMarshal.cs
Källa:
CollectionsMarshal.cs
Källa:
CollectionsMarshal.cs

Hämtar en referens till en TValue i Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>, och lägger till en ny post med ett standardvärde om den inte finns i 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

Typparametrar

TKey

Typ av nycklar i ordlistan.

TValue

Typ av värden i ordlistan.

TAlternateKey

Typ av alternativ nyckel i ordlistesökningen.

Parametrar

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

Ordlistan som referensen ska hämtas från TValue .

key
TAlternateKey

Nyckeln som används för sökning.

exists
Boolean

Om en ny post för den angivna nyckeln har lagts till i ordlistan eller inte.

Returer

TValue

En referens till en TValue i angiven Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>.

Kommentarer

Objekt ska inte läggas till eller tas bort från den Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey> stund som referensen TValue används.

Gäller för

GetValueRefOrAddDefault<TKey,TValue>(Dictionary<TKey,TValue>, TKey, Boolean)

Källa:
CollectionsMarshal.cs
Källa:
CollectionsMarshal.cs
Källa:
CollectionsMarshal.cs
Källa:
CollectionsMarshal.cs
Källa:
CollectionsMarshal.cs

Hämtar en referens till en TValue i den angivna ordlistan och lägger till en ny post med ett standardvärde om nyckeln inte finns.

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

Typparametrar

TKey

Typ av nyckel.

TValue

Typ av värde.

Parametrar

dictionary
Dictionary<TKey,TValue>

Ordlistan som du vill hämta referensen till TValue från.

key
TKey

Nyckeln som används för sökning.

exists
Boolean

När den här metoden returneras true innehåller den om key den redan finns i ordlistan och false om en ny post har lagts till.

Returer

TValue

En referens till en TValue i den angivna ordlistan.

Kommentarer

Objekt ska inte läggas till eller tas bort från den Dictionary<TKey,TValue> stund som referensen TValue används.

Gäller för