Open sandboxFocus

Method TryGetArgumentValue

TryGetArgumentValue<T>(IAttribute, string, out T)

Tries to gets the value of an argument given its name, considering both NamedArguments and ConstructorArguments. For constructor arguments, the name of the corresponding parameter is taken into account. Comparisons are case-insensitive. In case of ambiguity, the first match wins.

Declaration
public static bool TryGetArgumentValue<T>(this IAttribute attribute, string name, out T value)
Parameters
Type Name Description
IAttribute attribute

The attribute to query.

string name

The name of the argument.

T value

When this method returns true, contains the value of the argument; otherwise, the default value.

Returns
Type Description
bool

true if the argument was found; otherwise, false.

Type Parameters
Name Description
T

The expected type of the argument value.