PostSharpAPI ReferencePost­Sharp.​Patterns.​ContractsCredit­Card­Attribute
Open sandboxFocus

CreditCardAttribute Class

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 credit card number. Null strings are accepted and do not throw an exception.

Inheritance
CreditCardAttribute
Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
[HasConstraint]
public sealed class CreditCardAttribute : LocationContractAttribute, ILocationLevelAspect, IAspect
Remarks

Error message is identified by CreditCardErrorMessage.

Constructors

Name Description
CreditCardAttribute()

Initializes a new CreditCardAttribute.

Methods

Name Description
GetErrorMessage()

Gets unformatted error message as defined by the instance.

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.