CollectionsMarshal.GetValueRefOrAddDefault<TKey,TValue> 메서드

정의

지정된 사전에서 에 대한 참조를 TValue 가져오고 키가 없는 경우 기본값이 있는 새 항목을 추가합니다.

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

형식 매개 변수

TKey

키의 형식입니다.

TValue

값의 형식입니다.

매개 변수

dictionary
Dictionary<TKey,TValue>

참조를 가져올 사전입니다 TValue .

key
TKey

조회에 사용되는 키입니다.

exists
Boolean

이 메서드가 반환될 때 는 사전에 이미 있는 경우 keyfalse 새 항목이 추가된 경우 를 포함합니다true.

반환

TValue

지정된 사전의 에 대한 참조 TValue 입니다.

설명

참조 TValue 가 사용 중인 동안에는 에 항목을 추가하거나 에서 Dictionary<TKey,TValue> 제거해서는 안 됩니다.

적용 대상