DbConnectionStringBuilder.Count プロパティ
この記事の内容
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ConnectionString プロパティ内に含まれる現在のキー数を取得します。
public:
virtual property int Count { int get(); };
public virtual int Count { get; }
[System.ComponentModel.Browsable(false)]
public virtual int Count { get; }
member this.Count : int
[<System.ComponentModel.Browsable(false)>]
member this.Count : int
Public Overridable ReadOnly Property Count As Integer
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();
}
Sub Main()
Dim builder As New DbConnectionStringBuilder
builder.ConnectionString = _
"Data Source=(local);Initial Catalog=AdventureWorks;" & _
"Integrated Security=SSPI"
' This should display "3" in the console window.
Console.WriteLine(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(builder.Count)
Console.WriteLine()
Console.WriteLine("Press Enter to finish.")
Console.ReadLine()
End Sub
製品 | バージョン |
---|---|
.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 |