Method ThrowIfInvalid
ThrowIfInvalid(AttributeInfo, string?)
Validates an AttributeInfo
public static void ThrowIfInvalid(this AttributeInfo self, string? name = null)
Parameters
selfAttributeInfoAttributeInfo to validate
namestringName of the attribute self [Normally generated by compiler]
Exceptions
- ArgumentException
Attribute is invalid or not supported on the specified index
ThrowIfInvalid(AttributeInfo, AttributeAllowedOn, AttributeArgKind, string?)
Validates an AttributeInfo
public static void ThrowIfInvalid(this AttributeInfo self, AttributeAllowedOn allowedOn, AttributeArgKind kind, string? name = null)
Parameters
selfAttributeInfoAttributeInfo to validate
allowedOnAttributeAllowedOnlocation to validate the attribute supports
kindAttributeArgKindRequired kind of argument for the attribute
namestringName of the attribute self [Normally generated by compiler]
Exceptions
- ArgumentException
Attribute is invalid or not supported on the specified index
ThrowIfInvalid(AttributeInfo, FunctionAttributeIndex, string?)
Throws an exception if the attribute is invalid for the given index
public static void ThrowIfInvalid(this AttributeInfo self, FunctionAttributeIndex index, string? name = null)
Parameters
selfAttributeInfoAttributeInfo to test
indexFunctionAttributeIndexFunction index to test if the attribute is valid for
namestringName of the expression creating this test [Normally provided by compiler]
Exceptions
- InvalidEnumArgumentException
Index is invalid
- ArgumentException
Attribute is not valid or not valid on the given index.