Export (0) Print
Expand All

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 Nothing.

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( _

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

    ' Get the element. 
    Dim url As UrlConfigElement = _

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

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

End Sub 'GetElementValidator    

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft