Redigera

Dela via


StringValidator Constructors

Definition

Initializes a new instance of the StringValidator class.

Overloads

StringValidator(Int32)

Initializes a new instance of the StringValidator class, based on a supplied parameter.

StringValidator(Int32, Int32)

Initializes a new instance of the StringValidator class, based on supplied parameters.

StringValidator(Int32, Int32, String)

Initializes a new instance of the StringValidator class, based on supplied parameters.

StringValidator(Int32)

Source:
StringValidator.cs
Source:
StringValidator.cs

Initializes a new instance of the StringValidator class, based on a supplied parameter.

public:
 StringValidator(int minLength);
public StringValidator (int minLength);
new System.Configuration.StringValidator : int -> System.Configuration.StringValidator
Public Sub New (minLength As Integer)

Parameters

minLength
Int32

An integer that specifies the minimum length of the string value.

Remarks

The StringValidator constructor verifies the minimum acceptable length of the string being validated.

Applies to

StringValidator(Int32, Int32)

Source:
StringValidator.cs
Source:
StringValidator.cs

Initializes a new instance of the StringValidator class, based on supplied parameters.

public:
 StringValidator(int minLength, int maxLength);
public StringValidator (int minLength, int maxLength);
new System.Configuration.StringValidator : int * int -> System.Configuration.StringValidator
Public Sub New (minLength As Integer, maxLength As Integer)

Parameters

minLength
Int32

An integer that specifies the minimum length of the string value.

maxLength
Int32

An integer that specifies the maximum length of the string value.

Remarks

This StringValidator constructor ensures that the string being verified adheres to both a minimum and a maximum length.

Applies to

StringValidator(Int32, Int32, String)

Source:
StringValidator.cs
Source:
StringValidator.cs

Initializes a new instance of the StringValidator class, based on supplied parameters.

public:
 StringValidator(int minLength, int maxLength, System::String ^ invalidCharacters);
public StringValidator (int minLength, int maxLength, string invalidCharacters);
new System.Configuration.StringValidator : int * int * string -> System.Configuration.StringValidator
Public Sub New (minLength As Integer, maxLength As Integer, invalidCharacters As String)

Parameters

minLength
Int32

An integer that specifies the minimum length of the string value.

maxLength
Int32

An integer that specifies the maximum length of the string value.

invalidCharacters
String

A string that represents invalid characters.

Examples

The following example demonstrates how to use this StringValidator constructor. This code example is part of a larger example provided for the StringValidator class.

// Create string and validator.
string testVal = "filename";
StringValidator myStrValidator = new StringValidator(1,8,"$%^");
' Create string and validator.
Dim testVal As String = "filename"
Dim myStrValidator As StringValidator = New StringValidator(1, 8, "$%^")

Remarks

This StringValidator constructor ensures that the string being validated adheres to both a minimum and a maximum length, and also ensures that specific characters are excluded in the string.

Applies to