TryGet(String, out T?) Method

Definition

Assembly CliInvoke.Core.dll

Attempts to get a value by key, cast to the specified type, without throwing.

public bool TryGet<T>(string key, scoped out T? value)

Type parameters

T
The expected type of the value.

Parameters

key
String

The key to look up.

value
{T}

When this method returns, contains the value cast to T, or default when the key does not exist, the stored value is null, or the value cannot be cast to T.

Returns

Boolean
true when the key exists and the value is of (or assignable to) T; otherwise, false. This method never throws, per the Try* convention.