CollectionExtensions.GetValueOrDefault 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
오버로드
| Name | Description |
|---|---|
| GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey) |
에 지정된 |
| GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue) |
에 지정된 |
GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey)
에 지정된 keydictionary값과 연결된 값을 가져오려고 시도합니다.
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static TValue GetValueOrDefault(System::Collections::Generic::IReadOnlyDictionary<TKey, TValue> ^ dictionary, TKey key);
public static TValue GetValueOrDefault<TKey,TValue>(this System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> dictionary, TKey key);
static member GetValueOrDefault : System.Collections.Generic.IReadOnlyDictionary<'Key, 'Value> * 'Key -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TKey, TValue) (dictionary As IReadOnlyDictionary(Of TKey, TValue), key As TKey) As TValue
형식 매개 변수
- TKey
사전에 있는 키의 형식입니다.
- TValue
사전에 있는 값의 형식입니다.
매개 변수
- dictionary
- IReadOnlyDictionary<TKey,TValue>
형식의 키와 형식 TKeyTValue의 값이 있는 사전입니다.
- key
- TKey
가져올 값의 키입니다.
반품
인스턴스입니다 TValue . 메서드가 성공하면 반환된 개체는 지정된 key값과 연결된 값입니다. 메서드가 실패하면 에 대한 TValue값을 반환합니다default.
예외
dictionary은 null입니다.
적용 대상
GetValueOrDefault<TKey,TValue>(IReadOnlyDictionary<TKey,TValue>, TKey, TValue)
에 지정된 keydictionary값과 연결된 값을 가져오려고 시도합니다.
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static TValue GetValueOrDefault(System::Collections::Generic::IReadOnlyDictionary<TKey, TValue> ^ dictionary, TKey key, TValue defaultValue);
public static TValue GetValueOrDefault<TKey,TValue>(this System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> dictionary, TKey key, TValue defaultValue);
static member GetValueOrDefault : System.Collections.Generic.IReadOnlyDictionary<'Key, 'Value> * 'Key * 'Value -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TKey, TValue) (dictionary As IReadOnlyDictionary(Of TKey, TValue), key As TKey, defaultValue As TValue) As TValue
형식 매개 변수
- TKey
사전에 있는 키의 형식입니다.
- TValue
사전에 있는 값의 형식입니다.
매개 변수
- dictionary
- IReadOnlyDictionary<TKey,TValue>
형식의 키와 형식 TKeyTValue의 값이 있는 사전입니다.
- key
- TKey
가져올 값의 키입니다.
- defaultValue
- TValue
지정된 key값과 연결된 값을 찾을 수 없을 때 dictionary 반환할 기본값입니다.
반품
인스턴스입니다 TValue . 메서드가 성공하면 반환된 개체는 지정된 key값과 연결된 값입니다. 메서드가 실패하면 defaultValue.
예외
dictionary은 null입니다.