<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0-rc.2.20475.5" />

System.ComponentModel.DataAnnotations.StringLengthAttribute

Specifies the minimum and maximum length of characters that are allowed in a data field.
namespace System.ComponentModel.DataAnnotations { public class StringLengthAttribute : ValidationAttribute { public int MaximumLength { get; } public int MinimumLength { get; set; } public StringLengthAttribute(int maximumLength); } }