DbConnectionStringBuilder.Keys プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DbConnectionStringBuilder.Keys プロパティの意味・解説 

DbConnectionStringBuilder.Keys プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

DbConnectionStringBuilder 内のキー格納している ICollection を取得します

名前空間: System.Data.Common
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Overridable ReadOnly
 Property Keys As ICollection
Dim instance As DbConnectionStringBuilder
Dim value As ICollection

value = instance.Keys
public virtual ICollection Keys { get; }
public:
virtual property ICollection^ Keys {
    ICollection^ get ();
}
/** @property */
public ICollection get_Keys ()

プロパティ
DbConnectionStringBuilder 内のキー格納している ICollection

解説解説

ICollection格納される値の順序不定ですが、Values プロパティから返される ICollection 内の対応する値と同じ順序なります

返される ICollection静的コピーではありません。代わりに、この ICollection は、元の DbConnectionStringBuilderキー参照します。そのため、DbConnectionStringBuilder対す変更は、ICollection反映されます。

使用例使用例

新しDbConnectionStringBuilder作成してキー追加するコンソール アプリケーションの例を次に示します。このコードでは、Keys プロパティから返されICollectionループ処理しながらキー/値ペア表示した後、新しキー追加しますKeys プロパティ動的な ICollection返すため、2 番目のループでは最新キー/値ペアを含むすべてのキー/値ペア表示します

Sub Main()
    Dim builder As New DbConnectionStringBuilder
    builder("Data Source") = "(local)"
    builder("integrated security") = True
    builder("Initial Catalog") = "AdventureWorks;NewValue=Bad"

    ' Obtain reference to the collection of keys.
    Dim keys As ICollection = builder.Keys

    Console.WriteLine("Keys before adding TimeOut:")
    For Each key As String
 In keys
        Console.WriteLine("{0}={1}", key, builder(key))
    Next

    ' Add a new item to the collection.
    builder("Timeout") = 300

    Console.WriteLine()
    Console.WriteLine("Keys after adding TimeOut:")

    ' Because the Keys property is dynamically updated, 
    ' the following loop includes the Timeout key.
    For Each key As String
 In keys
        Console.WriteLine("{0}={1}", key, builder(key))
    Next

    Console.WriteLine()
    Console.WriteLine("Press Enter to continue.")
    Console.ReadLine()
End Sub
static void Main()
{
    DbConnectionStringBuilder builder = new
        DbConnectionStringBuilder();
    builder["Data Source"] = "(local)";
    builder["Integrated Security"] = true;
    builder["Initial Catalog"] = "AdventureWorks";

    // Obtain reference to the collection of keys.
    ICollection keys = builder.Keys;

    Console.WriteLine("Keys before adding TimeOut:");
    foreach (string key in
 keys)
        Console.WriteLine("{0}={1}", key, builder[key]);

    // Add a new item to the collection.
    builder["Timeout"] = 300;

    Console.WriteLine();
    Console.WriteLine("Keys after adding TimeOut:");

    // Because the Keys property is dynamically updated, 
    // the following loop includes the Timeout key.
    foreach (string key in
 keys)
        Console.WriteLine("{0}={1}", key, builder[key]);
    Console.WriteLine();
    Console.WriteLine("Press Enter to continue.");
    Console.ReadLine();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DbConnectionStringBuilder クラス
DbConnectionStringBuilder メンバ
System.Data.Common 名前空間
その他の技術情報
接続文字列使用


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

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

辞書ショートカット

すべての辞書の索引

DbConnectionStringBuilder.Keys プロパティのお隣キーワード
検索ランキング

   

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



DbConnectionStringBuilder.Keys プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS