ElementInformation.IsLocked Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value that indicates whether the associated ConfigurationElement object cannot be modified.

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

public bool IsLocked { get; }

Property Value

Type: System.Boolean

true if the associated ConfigurationElement object cannot be modified; otherwise, false.

The IsLocked property returns true when the related element is locked by the AllowOverride, AllowDefinition, or LockAllAttributesExcept property.

The following example shows how to use the IsLocked property.

static public void IsElementLocked()
    // Get the current configuration file.
    System.Configuration.Configuration config =

    // Get the section.
    UrlsSection section =

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

    bool isLocked =
    Console.WriteLine("Url element is locked? {0}",


.NET Framework
Available since 2.0
Return to top