MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsRequired­Attribute
Open sandboxFocus

RequiredAttribute Class

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

  • an System.ArgumentNullException if the target is assigned a null value;
  • an ArgumentOutOfRangeException if the target is assigned an empty or white-space string.
Inheritance
System.Object
RequiredAttribute
Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public sealed class RequiredAttribute : ContractBaseAttribute, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider

Constructors

Name Description
RequiredAttribute()

Initializes a new instance of the RequiredAttribute class.

Methods

Name Description
BuildAspect(IAspectBuilder<IFieldOrPropertyOrIndexer>)
BuildAspect(IAspectBuilder<IParameter>)
BuildEligibility(IEligibilityBuilder<IFieldOrPropertyOrIndexer>)
BuildEligibility(IEligibilityBuilder<IParameter>)
Validate(Object)

See Also