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

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

ConnectionStringSettingsCollection.RemoveAt メソッド

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

コレクション内の指定したインデックス位置にある ConnectionStringSettings オブジェクト削除します

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

Public Sub RemoveAt ( _
    index As Integer _
)
Dim instance As ConnectionStringSettingsCollection
Dim index As Integer

instance.RemoveAt(index)
public void RemoveAt (
    int index
)
public:
void RemoveAt (
    int index
)
public void RemoveAt (
    int index
)

パラメータ

index

ConnectionStringSettings オブジェクトの、コレクション内でのインデックス

使用例使用例

指定したインデックス位置にある ConnectionStringSettings オブジェクト削除する方法の例を次に示します

Shared Sub RemoveConnectionStrings3() 
    
    Try
        ' Get the application configuration file.
        Dim config _
        As System.Configuration.Configuration = _
        ConfigurationManager.OpenExeConfiguration( _
        ConfigurationUserLevel.None)

        ' Clear the connection strings collection.
        Dim csSection _
        As ConnectionStringsSection = _
        config.ConnectionStrings
        Dim csCollection _
        As ConnectionStringSettingsCollection = _
        csSection.ConnectionStrings
        
        ' Remove the element.
        csCollection.RemoveAt(0)
        
        ' Save the configuration file.
        config.Save(ConfigurationSaveMode.Modified)
        
        Console.WriteLine( _
        "Connection string settings removed.")

    Catch err As ConfigurationErrorsException
        Console.WriteLine(err.ToString())
    End Try

End Sub 'RemoveConnectionStrings3

static void RemoveConnectionStrings3()
{

    try
    {
        System.Configuration.Configuration config =
         ConfigurationManager.OpenExeConfiguration(
         ConfigurationUserLevel.None);

        // Clear the connection strings collection.
        ConnectionStringsSection csSection =
            config.ConnectionStrings;
        ConnectionStringSettingsCollection csCollection =
         csSection.ConnectionStrings;

        // Remove the element.
        csCollection.RemoveAt(0);

        // Save the configuration file.
        config.Save(ConfigurationSaveMode.Modified);
        
        Console.WriteLine(
             "Connection string settings removed.");
    }
    catch (ConfigurationErrorsException err)
    {
        Console.WriteLine(err.ToString());
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConnectionStringSettingsCollection クラス
ConnectionStringSettingsCollection メンバ
System.Configuration 名前空間
ConnectionStringsSection


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS