다음을 통해 공유


OrderedDictionary<TKey,TValue>.TryAdd 메서드

정의

오버로드

TryAdd(TKey, TValue, Int32)
TryAdd(TKey, TValue)

키가 아직 없는 경우 지정된 키와 값을 사전에 추가합니다.

TryAdd(TKey, TValue, Int32)

Source:
OrderedDictionary.cs
public:
 bool TryAdd(TKey key, TValue value, [Runtime::InteropServices::Out] int % index);
public bool TryAdd(TKey key, TValue value, out int index);
member this.TryAdd : 'Key * 'Value * int -> bool
Public Function TryAdd (key As TKey, value As TValue, ByRef index As Integer) As Boolean

매개 변수

key
TKey
value
TValue
index
Int32

반환

적용 대상

TryAdd(TKey, TValue)

Source:
OrderedDictionary.cs
Source:
OrderedDictionary.cs

키가 아직 없는 경우 지정된 키와 값을 사전에 추가합니다.

public:
 bool TryAdd(TKey key, TValue value);
public bool TryAdd(TKey key, TValue value);
member this.TryAdd : 'Key * 'Value -> bool
Public Function TryAdd (key As TKey, value As TValue) As Boolean

매개 변수

key
TKey

추가할 요소의 키입니다.

value
TValue

추가할 요소의 값입니다. 참조 형식에 대해 값을 null 수 있습니다.

반환

키가 없고 키와 값이 사전에 추가되었는지 true. 그렇지 않으면 false.

예외

키가 null.

적용 대상