MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsNot­Empty­Attribute
Open sandboxFocus

NotEmptyAttribute Class

Custom attribute that, when added to a field, property or parameter, throws an ArgumentException if the target is assigned an empty value. The custom attributes can be added to locations of type System.String (where empty means zero characters), or ICollection, System.Collections.Generic.ICollection<>, System.Collections.Generic.IReadOnlyCollection<>, arrays or System.Collections.Immutable.ImmutableArray<> (where empty means zero items). Null references or default System.Collections.Immutable.ImmutableArray<> instances are accepted and do not throw an exception.

Inheritance
System.Object
NotEmptyAttribute
Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public sealed class NotEmptyAttribute : ContractBaseAttribute, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider

Constructors

Name Description
NotEmptyAttribute()

Initializes a new instance of the NotEmptyAttribute class.

Methods

Name Description
BuildEligibility(IEligibilityBuilder<IFieldOrPropertyOrIndexer>)
Validate(Object)