PostSharpAPI ReferencePost­Sharp.​Patterns.​ContractsNot­Null­Attribute
Open sandboxFocus

NotNullAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentNullException if the target is assigned a null value.

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

Error message is identified by NotNullErrorMessage.

Constructors

Name Description
NotNullAttribute()

Initializes a new ArgumentNullException.

Methods

Name Description
GetErrorMessage()

Gets unformatted error message as defined by the instance.

ValidateValueDynamic(Object, String, LocationKind, LocationValidationContext)