英語で読む

次の方法で共有


DbConnectionStringBuilder.Count プロパティ

定義

ConnectionString プロパティ内に含まれる現在のキー数を取得します。

public virtual int Count { get; }
[System.ComponentModel.Browsable(false)]
public virtual int Count { get; }

プロパティ値

DbConnectionStringBuilder インスタンスで保守されている接続文字列内に含まれるキーの数。

実装

属性

次の例では、プロパティの内容を Count 変更する前と後の両方のプロパティを ConnectionString 示します。

static void Main()
{
    DbConnectionStringBuilder builder = new DbConnectionStringBuilder();
    builder.ConnectionString =
        "Data Source=(local);Initial Catalog=AdventureWorks;" +
        "Integrated Security=SSPI";

    // This should display "3" in the console window.
    Console.WriteLine("Original count: " + builder.Count);

    builder.Add("Connection Timeout", 25);

    // This should display the new connection string and
    // the number of items (4) in the console window.
    Console.WriteLine(builder.ConnectionString);
    Console.WriteLine("New count: " + builder.Count);

    Console.WriteLine();
    Console.WriteLine("Press Enter to finish.");
    Console.ReadLine();
}

適用対象

製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

こちらもご覧ください