Open sandboxFocus

Class RegularExpressionAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned a value that does not match a given regular expression. If the target is a nullable type, null strings are accepted and do not throw an exception.

Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public class RegularExpressionAttribute : RegularExpressionBaseAttribute, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider
Remarks

Error message can use additional argument {4} to refer to the regular expression used.

Constructors

Name Description
RegularExpressionAttribute(string, RegexOptions)

Properties

Name Description
Options
Pattern

Methods

Name Description
GetRegex()

See Also