ElementInformation.Errors Property

 

Gets the errors for the associated element and subelements

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

public ICollection Errors { get; }

Property Value

Type: System.Collections.ICollection

The collection containing the errors for the associated element and subelements

The following example shows how to use the Errors collection.

static public void GetElementErrors()
{
    // 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 errors.
    ICollection errors = 
        url.ElementInformation.Errors;
    Console.WriteLine("Number of errors: {0)",
        errors.Count.ToString());

}

.NET Framework
Available since 2.0
Return to top
Show: