<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0-preview.5.21301.5" />

StringValidatorAttribute

Declaratively instructs the .NET Framework to perform string validation on a configuration property. This class cannot be inherited.
public string InvalidCharacters { get; set; }

Gets or sets the invalid characters for the property.

public int MaxLength { get; set; }

Gets or sets the maximum length allowed for the string to assign to the property.

public int MinLength { get; set; }

Gets or sets the minimum allowed value for the string to assign to the property.

Initializes a new instance of the StringValidatorAttribute class.