DbConnectionStringBuilder.Count Property
.NET Framework 4
Gets the current number of keys that are contained within the ConnectionString property.
Assembly: System.Data (in System.Data.dll)
Property Value
Type: System.Int32The number of keys that are contained within the connection string maintained by the DbConnectionStringBuilder instance.
Implements
ICollection.CountThe following example demonstrates the Count property both before and after you modify the contents of the ConnectionString property.
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(); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.