ElementInformation.Type Property

 

Gets the type of the associated ConfigurationElement object.

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

public Type Type { get; }

Property Value

Type: System.Type

The type of the associated ConfigurationElement object.

The following example shows how to use the Type property.

static public void GetElementType()
{
    // Get the current configuration file.
    System.Configuration.Configuration config =
            ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None);

    // Get the section.
    UrlsSection section =
        (UrlsSection)config.GetSection("MyUrls");

    // Get the element.
    UrlConfigElement url = section.Simple;

    // Get the element type.
    Type elType =
        url.ElementInformation.Type;

    Console.WriteLine("Url element type: {0}",
                    elType.ToString());

}

.NET Framework
Available since 2.0
Return to top
Show: