Open sandboxFocus

Class EmailAddressAttribute

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 email address. Null strings are accepted and do not throw an exception.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
[AspectConfiguration(SerializerType = typeof(MsilAspectSerializer))]
public sealed class EmailAddressAttribute : RegularExpressionAttribute, ILocationLevelAspect, IAspect
Remarks

Error message is identified by EmailAddressErrorMessage.

Constructors

Name Description
EmailAddressAttribute()

Initializes a new EmailAddressAttribute.

Methods

Name Description
GetErrorMessage()

Gets unformatted error message as defined by the instance.