API Reference: MinCountAttribute Class

The MinCountAttribute can be applied to collection-based content model properties. The attribute sets the minimum number of items that must be added to the property value in the back office application. The back office will display a validation error if the minimum is not reached.

You can combine this attribute with the MaxCount attribute to specify a min/max range.


Decorate the model property with the MinCountAttribute. Pass the minimum required number of items in the attribute constructor.

The attribute can only be applied to collection-based properties (i.e. IList<T>, ICollection<T>, etc.). An exception will be thrown if the attribute is applied to a non-collection-based property.


The following example specifies a minimum count of 2 items for the PageLinks property (as well as a maximum count of 5).

public class SampleContent: IContentType
    public IReadOnlyList<Link> PageLinks { get; set; }

    // ...