OracleConnectionStringBuilder.Keys 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取包含 ICollection 中的键的 OracleConnectionStringBuilder。
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
属性值
一个 ICollection,它包含 OracleConnectionStringBuilder 中的键。
示例
以下控制台应用程序示例新建一个 OracleConnectionStringBuilder。 该代码循环访问显示键/值对的 ICollection 属性返回的 Keys。
// You may need to set a reference to the System.Data.OracleClient
// assembly before running this example.
using System.Data.OracleClient;
class Program
{
static void Main()
{
OracleConnectionStringBuilder builder =
new OracleConnectionStringBuilder();
builder.DataSource = "OracleSample";
builder.IntegratedSecurity = true;
// 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();
}
}
' You may have to set a reference to the System.Data.OracleClient
' assembly before running this example.
Imports System.Data.OracleClient
Module Module1
Sub Main()
Dim builder As New OracleConnectionStringBuilder
builder.DataSource = "OracleSample"
builder.IntegratedSecurity = True
' 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
注解
ICollection 中的值的顺序未指定,但与 ICollection 属性返回的 Values 中的关联值顺序相同。