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

이 메서드가 반환될 때 사전에 이미 있는지, false 새 항목이 추가되었는지를 포함합니다.true key

반환

TValue

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

설명

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

적용 대상