MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsEnum­Data­Type­Attribute
Open sandboxFocus

EnumDataTypeAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an System.ArgumentException if the target is assigned a value that is not a valid member of an enumeration.

Inheritance
System.Object
EnumDataTypeAttribute
Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public sealed class EnumDataTypeAttribute : ContractBaseAttribute, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider
Remarks

Strings are matched against enumeration member names. Integers are matched against enumeration member values. If the target is a nullable type, null values are accepted and do not throw exception.

Constructors

Name Description
EnumDataTypeAttribute(Type)

Initializes a new instance of the EnumDataTypeAttribute class.

Properties

Name Description
EnumType

Gets the enumeration type.

Methods

Name Description
BuildEligibility(IEligibilityBuilder<IFieldOrPropertyOrIndexer>)
BuildEligibility(IEligibilityBuilder<IParameter>)
Validate(Object)

See Also