PostSharpAPI ReferencePost­Sharp.​Patterns.​ContractsRegular­Expression­Attribute
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. Null strings are accepted and do not throw an exception.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
public class RegularExpressionAttribute : LocationContractAttribute, ILocationLevelAspect, IAspect


Name Description

Initializes a new RegularExpressionAttribute.

RegularExpressionAttribute(String, RegexOptions)

Initializes a new RegularExpressionAttribute and specify options.


Name Description

Gets unformatted error message as defined by the instance.


Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute. There arguments can be referenced from error message string by {4}, {5} and so on.

ValidateValue(String, String, LocationKind, LocationValidationContext)
ValidateValueDynamic(Object, String, LocationKind, LocationValidationContext)

Validates a weakly-typed (boxed) value, typically the value of a dependency property or an attached property.