ConfigurationElement.IsReadOnly-Methode
.NET Framework 2.0
Hinweis: Diese Methode ist neu in .NET Framework, Version 2.0.
Ruft einen Wert ab, der angibt, ob das ConfigurationElement-Objekt schreibgeschützt ist.
Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)
Assembly: System.Configuration (in system.configuration.dll)
Im folgenden Beispiel wird die Verwendung der IsReadOnly-Methode veranschaulicht. Sie wird für einen benutzerdefinierten Abschnitt verwendet und gibt false zurück.
// Show how to use IsReadOnly. // It loops to see if the elements are read only. static void ReadOnlyElements() { try { // Get the configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); // Get the MyUrls section. UrlsSection myUrlsSection = config.GetSection("MyUrls") as UrlsSection; UrlsCollection elements = myUrlsSection.Urls; IEnumerator elemEnum = elements.GetEnumerator(); int i = 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; } } catch (ConfigurationErrorsException err) { Console.WriteLine("[ReadOnlyElements: {0}]", err.ToString()); } }
Windows 98, Windows 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
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.