Count Property

DbConnectionStringBuilder.Count Property

 

Gets the current number of keys that are contained within the ConnectionString property.

Namespace:   System.Data.Common
Assembly:  System.Data (in System.Data.dll)

<BrowsableAttribute(False)>
Public Overridable ReadOnly Property Count As Integer

Property Value

Type: System.Int32

The number of keys that are contained within the connection string maintained by the DbConnectionStringBuilder instance.

The following example demonstrates the Count property both before and after you modify the contents of the ConnectionString property.

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

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft