PostSharp//API Reference/Post­Sharp.​Patterns.​Contracts/Required­Attribute
Open sandboxFocus

Class RequiredAttribute

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

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

Constructors

Name Description
RequiredAttribute()

Initializes a new RequiredAttribute.

Methods

Name Description
GetErrorMessage()
ValidateValueDynamic(Object, String, LocationKind, LocationValidationContext)

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

ValidateValueObject(Object, String, LocationKind, LocationValidationContext)
ValidateValueString(String, String, LocationKind, LocationValidationContext)