ConfigurationPropertyCollection.Remove メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConfigurationPropertyCollection.Remove メソッドの意味・解説 

ConfigurationPropertyCollection.Remove メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

構成プロパティコレクションから削除します

名前空間: System.Configuration
アセンブリ: System.Configuration (system.configuration.dll 内)
構文構文

解説解説

戻り値false のときは、指定した ConfigurationProperty オブジェクトコレクション格納されていなかったことを示します

使用例使用例

Remove メソッド使用する方法の例を次に示します

' 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());
    }

}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConfigurationPropertyCollection クラス
ConfigurationPropertyCollection メンバ
System.Configuration 名前空間
ConfigurationProperty クラス
ConfigurationSection
ElementInformation
ConfigurationElementCollection クラス
ConfigurationElementCollectionType 列挙
ConfigurationElement クラス
ConfigurationSection


このページでは「.NET Framework クラス ライブラリ リファレンス」からConfigurationPropertyCollection.Remove メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からConfigurationPropertyCollection.Remove メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からConfigurationPropertyCollection.Remove メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ConfigurationPropertyCollection.Remove メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConfigurationPropertyCollection.Remove メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS