Open sandboxFocus

Method GetArgumentValue

GetArgumentValue<T>(IAttribute, string, 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 T? GetArgumentValue<T>(this IAttribute attribute, string name, T? defaultValue = default)
Parameters
Type Name Description
IAttribute attribute

The attribute to query.

string name

The name of the argument.

T defaultValue

The value to return if the argument is not found.

Returns
Type Description
T

The value of the argument, or defaultValue if not found.

Type Parameters
Name Description
T

The expected type of the argument value.