ConfigurationElement.IsReadOnly Method
.NET Framework 3.0
Gets a value indicating whether the ConfigurationElement object is read-only.
Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)
Assembly: System.Configuration (in system.configuration.dll)
'Declaration Public Overridable Function IsReadOnly As Boolean 'Usage Dim instance As ConfigurationElement Dim returnValue As Boolean returnValue = instance.IsReadOnly
public boolean IsReadOnly ()
public function IsReadOnly () : boolean
Not applicable.
Return Value
true if the ConfigurationElement object is read-only; otherwise, false.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() Try ' Get the current configuration file. Dim config _ As System.Configuration.Configuration = _ ConfigurationManager.OpenExeConfiguration( _ ConfigurationUserLevel.None) ' Get the MyUrls section. Dim myUrlsSection As UrlsSection = _ config.GetSection("MyUrls") Dim elements As UrlsCollection = _ myUrlsSection.Urls Dim elemEnum As IEnumerator = _ elements.GetEnumerator() Dim i As Integer = 0 Console.WriteLine(elements.Count.ToString()) 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}]", _ err.ToString()) End Try End Sub 'ReadOnlyElements
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: