This documentation is archived and is not being maintained.

ConfigurationElement.IsReadOnly Method

Gets a value indicating whether the ConfigurationElement object is read-only.

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

Public Overridable Function IsReadOnly As Boolean
Dim instance As ConfigurationElement 
Dim returnValue As Boolean 

returnValue = instance.IsReadOnly()

Return Value

Type: System.Boolean
true if the ConfigurationElement object is read-only; otherwise, false.

The system defines configuration elements that cannot be modified.

To determine which elements can be modified, use the IsReadOnly method.

The following example shows how to use the IsReadOnly method. It is used on a custom section and returns false.

' Show how to use IsReadOnly. 
' It loops to see if the elements are read only.  
Shared Sub ReadOnlyElements()
        ' Get the current configuration file. 
        Dim config _
        As System.Configuration.Configuration = _
        ConfigurationManager.OpenExeConfiguration( _

        ' Get the MyUrls section. 
        Dim myUrlsSection As UrlsSection = _

        Dim elements As UrlsCollection = _

        Dim elemEnum As IEnumerator = _

        Dim i As Integer = 0

        While elemEnum.MoveNext()
            Console.WriteLine("The element {0} is read only: {1}", _
            elements(i).Name, elements(i).IsReadOnly().ToString())
            i += 1
        End While 
    Catch err As ConfigurationErrorsException
        Console.WriteLine("[ReadOnlyElements: {0}]", _
    End Try 

End Sub 'ReadOnlyElements

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0