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

Dim instance As ConfigurationPropertyCollection Dim name As String Dim returnValue As Boolean returnValue = instance.Remove(name)
戻り値
指定した ConfigurationProperty が削除された場合は true。それ以外の場合は false。


' Remove an element from the property collection. ' It deletes the specified attribute from the ' configuration element represented by ' the property. Public Sub RemoveCollectionElement(elName As String) Properties.Remove(elName) End Sub 'RemoveCollectionElement
// Remove an element from the property collection. // It deletes the specified attribute from the // configuration element represented by // the property. public void RemoveCollectionElement(string elName) { Properties.Remove(elName); }
上記のメソッドを呼び出して、構成ファイルに変更を保存する方法の例を次に示します。
' Remove a collection of element. Shared Sub RemoveCollectionElement() 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") 'Remove the alias property. customSection.RemoveCollectionElement("alias") 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 'RemoveCollectionElement
// Remove a collection of element. static void RemoveCollectionElement() { try { CustomSection customSection; // Get the current configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); customSection = config.GetSection("CustomSection") as CustomSection; customSection.RemoveCollectionElement("alias"); 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.Remove メソッドを検索する場合は、下記のリンクをクリックしてください。

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