StringValidatorAttribute.MinLength Propiedad

Definición

Obtiene o establece el valor mínimo permitido para la cadena que se va a asignar a la propiedad.

public:
 property int MinLength { int get(); void set(int value); };
public int MinLength { get; set; }
member this.MinLength : int with get, set
Public Property MinLength As Integer

Valor de propiedad

Entero que indica la longitud mínima permitida para la cadena que se va a asignar a la propiedad.

Excepciones

El valor seleccionado es mayor que MaxLength.

Ejemplos

En el ejemplo siguiente se muestra cómo usar la propiedad MinLength.

[ConfigurationProperty("fileName", DefaultValue = "default.txt",
    IsRequired = true, IsKey = false)]
[StringValidator(InvalidCharacters = " ~!@#$%^&*()[]{}/;'\"|\\",
    MinLength = 1, MaxLength = 60)]
public string FileName
{
    get
    {
        return (string)this["fileName"];
    }
    set
    {
        this["fileName"] = value;
    }
}

<ConfigurationProperty("fileName", _
DefaultValue:="default.txt", _
IsRequired:=True, _
IsKey:=False), _
StringValidator( _
InvalidCharacters:=" ~!@#$%^&*()[]{}/;'""|\", _
MinLength:=1, _
MaxLength:=60)> _
Public Property FileName() As String
    Get
        Return CStr(Me("fileName"))
    End Get
    Set(ByVal value As String)
        Me("fileName") = value
    End Set
End Property

Se aplica a