ConfigurationPropertyCollection.Clear メソッド
アセンブリ: System.Configuration (system.configuration.dll 内)


' Clear the property. ' It deletes all the attributes of the ' configuration element represented by ' the property. Public Sub ClearCollection() Properties.Clear() End Sub 'ClearCollection
// Clear the property. // It deletes all the attributes of the // configuration element represented by // the property. public void ClearCollection() { Properties.Clear(); }
上記のメソッドを呼び出して、構成ファイルに変更を保存する方法の例を次に示します。
' Clear a collection of elements. Shared Sub ClearCollection() Try Dim customSection As CustomSection ' Get the current configuration file. Dim config As System.Configuration.Configuration = _ ConfigurationManager.OpenExeConfiguration( _ ConfigurationUserLevel.None) ' Get the custom section. customSection = _ config.GetSection("CustomSection") customSection.ClearCollection() If Not customSection.IsReadOnly() Then customSection.SectionInformation.ForceSave = True config.Save(ConfigurationSaveMode.Full) End If Catch err As ConfigurationErrorsException Console.WriteLine(err.ToString()) End Try End Sub 'ClearCollection
// Clear a collection of elements. static void ClearCollection() { try { CustomSection customSection; // Get the current configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); customSection = config.GetSection("CustomSection") as CustomSection; customSection.ClearCollection(); if (!customSection.IsReadOnly()) { customSection.SectionInformation.ForceSave = true; config.Save(ConfigurationSaveMode.Full); } } catch (ConfigurationErrorsException err) { Console.WriteLine(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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からConfigurationPropertyCollection.Clear メソッドを検索する場合は、下記のリンクをクリックしてください。

- ConfigurationPropertyCollection.Clear メソッドのページへのリンク