Method ThrowIfInvalid
ThrowIfInvalid(AttributeInfo, string?)
Validates an AttributeInfo
public static void ThrowIfInvalid(this AttributeInfo self, string? name = null)
Parameters
self
AttributeInfoAttributeInfo to validate
name
stringName 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
self
AttributeInfoAttributeInfo to validate
allowedOn
AttributeAllowedOnlocation to validate the attribute supports
kind
AttributeArgKindRequired kind of argument for the attribute
name
stringName 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
self
AttributeInfoAttributeInfo to test
index
FunctionAttributeIndexFunction index to test if the attribute is valid for
name
stringName 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.