ElementInformation.Validator Property

 

Gets the object used to validate the associated ConfigurationElement object.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

Public ReadOnly Property Validator As ConfigurationValidatorBase

Property Value

Type: System.Configuration.ConfigurationValidatorBase

The object used to validate the associated ConfigurationElement object.

A validator object is not required, and this property may return null.

The following example shows how to use the Validator property.

Public Shared Sub GetElementValidator() 

    ' Get the current configuration file.
    Dim config _
    As System.Configuration.Configuration = _
    ConfigurationManager.OpenExeConfiguration( _
    ConfigurationUserLevel.None)

    ' Get the section.
    Dim section As UrlsSection = _
    CType(config.GetSection("MyUrls"), UrlsSection)

    ' Get the element.
    Dim url As UrlConfigElement = _
    section.Simple

    ' Get the element source file.
    Dim elValidator _
    As ConfigurationValidatorBase = _
    url.ElementInformation.Validator

    Console.WriteLine("Url element validator: {0}", _
    elValidator.ToString())

End Sub 'GetElementValidator    

.NET Framework
Available since 2.0
Return to top
Show: