Delen via


AdditionalPropertiesDictionary<TValue>.TryGetValue Method

Definition

Overloads

TryGetValue(String, TValue)

Gets the value associated with the specified key.

TryGetValue<T>(String, T)

Attempts to extract a typed value from the dictionary.

TryGetValue(String, TValue)

Gets the value associated with the specified key.

public:
 bool TryGetValue(System::String ^ key, [Runtime::InteropServices::Out] TValue % value);
public bool TryGetValue (string key, out TValue value);
member this.TryGetValue : string * 'Value -> bool
Public Function TryGetValue (key As String, ByRef value As TValue) As Boolean

Parameters

key
String
value
TValue

Returns

true if the AdditionalPropertiesDictionary<TValue> contains an element with the specified key; otherwise false.

Implements

Applies to

TryGetValue<T>(String, T)

Attempts to extract a typed value from the dictionary.

public:
generic <typename T>
 bool TryGetValue(System::String ^ key, [Runtime::InteropServices::Out] T % value);
public bool TryGetValue<T> (string key, out T? value);
member this.TryGetValue : string * 'T -> bool
Public Function TryGetValue(Of T) (key As String, ByRef value As T) As Boolean

Type Parameters

T

Specifies the type of the value to be retrieved.

Parameters

key
String

The key to locate.

value
T

The value retrieved from the dictionary, if found and successfully converted to the requested type; otherwise, the default value of T.

Returns

true if a non-null value was found for key in the dictionary and converted to the requested type; otherwise, false.

Remarks

If a non-null value is found for the key in the dictionary, but the value is not of the requested type and is an IConvertible object, the method attempts to convert the object to the requested type.

Applies to