Attribute Extensions
Extensions for extracting attribute arguments fluently.
See also: Extensions Overview | Projections
AttributeData Extensions
Wrap in Projection
OptionalAttribute optional = attributeData.Query();
Type Checking
bool isObsolete = attributeData.Is<ObsoleteAttribute>();
T? typed = attributeData.As<ObsoleteAttribute>();
Get Arguments
// Named argument
OptionalArgument<int> retries = attributeData.GetNamedArgument<int>("MaxRetries");
int value = retries.OrDefault(3);
// Constructor argument by index
OptionalArgument<string> name = attributeData.GetConstructorArgument<string>(0);