SqlConnectionStringBuilder.Keys Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
ICollection Lekéri azokat a kulcsokat, amelyek a SqlConnectionStringBuilder.
public:
virtual property System::Collections::ICollection ^ Keys { System::Collections::ICollection ^ get(); };
public override System.Collections.ICollection Keys { get; }
member this.Keys : System.Collections.ICollection
Public Overrides ReadOnly Property Keys As ICollection
Tulajdonság értéke
Olyan ICollection , amely tartalmazza a kulcsokat a SqlConnectionStringBuilder.
Példák
A következő konzolalkalmazás-példa egy újat SqlConnectionStringBuilderhoz létre. A kód végighalad a ICollection kulcs/érték párokat megjelenítő tulajdonság által Keys visszaadott értéken.
using System.Data.SqlClient;
class Program
{
static void Main()
{
SqlConnectionStringBuilder builder =
new SqlConnectionStringBuilder();
builder.DataSource = "(local)";
builder.IntegratedSecurity = true;
builder.InitialCatalog = "AdventureWorks";
// Loop through the collection of keys, displaying
// the key and value for each item:
foreach (string key in builder.Keys)
Console.WriteLine("{0}={1}", key, builder[key]);
Console.WriteLine();
Console.WriteLine("Press Enter to continue.");
Console.ReadLine();
}
}
Imports System.Data.SqlClient
Module Module1
Sub Main()
Dim builder As New SqlConnectionStringBuilder
builder.DataSource = "(local)"
builder.IntegratedSecurity = True
builder.InitialCatalog = "AdventureWorks"
' Loop through the collection of keys, displaying
' the key and value for each item.
For Each key As String In builder.Keys
Console.WriteLine("{0}={1}", key, builder(key))
Next
Console.WriteLine()
Console.WriteLine("Press Enter to continue.")
Console.ReadLine()
End Sub
End Module
Megjegyzések
A benne lévő ICollection értékek sorrendje meghatározatlan, de megegyezik a tulajdonság által ICollection visszaadott társított értékekkelValues.