Open sandboxFocus

Class RequiredAttribute

Custom attribute that, when added to a field, property or parameter, throws:

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public sealed class RequiredAttribute : LocationContractAttribute, ILocationLevelAspect, IAspect
Remarks

Error message is identified by RequiredErrorMessage.

Constructors

Name Description
RequiredAttribute()

Initializes a new RequiredAttribute.

Methods

Name Description
GetErrorMessage()

Gets unformatted error message as defined by the instance.

ValidateValueDynamic(object, string, LocationKind, LocationValidationContext)

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