Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that is not a valid member of an enumeration.
Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public sealed class EnumDataTypeAttribute : LocationContractAttribute, ILocationLevelAspect, IAspectRemarks
<p>Strings are matched against enumeration member names. Integers
are matched against enumeration member values. Null values are accepted and do not throw exception.
Error message is identified by EnumDataTypeErrorMessage.
Error message can use additional argument
Constructors
| Name | Description |
|---|---|
| EnumDataTypeAttribute(Type) | Initializes a new EnumDataTypeAttribute. |
Properties
| Name | Description |
|---|---|
| EnumType | Gets the enumeration type. |
Methods
| Name | Description |
|---|---|
| GetErrorMessage() | Gets unformatted error message as defined by the instance. |
| GetErrorMessageArguments() | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute.
There arguments can be referenced from error message string by |