NetCodeGroup.GetConnectAccessRules 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得目前程式碼群組的連接存取資訊。
public:
cli::array <System::Collections::DictionaryEntry> ^ GetConnectAccessRules();
public System.Collections.DictionaryEntry[] GetConnectAccessRules ();
member this.GetConnectAccessRules : unit -> System.Collections.DictionaryEntry[]
Public Function GetConnectAccessRules () As DictionaryEntry()
傳回
DictionaryEntry 陣列包含連接存取資訊。
範例
下列程式代碼範例示範如何顯示 對象的連接存取規則 NetCodeGroup 。
static void DisplayConnectionAccessRules(NetCodeGroup^ group)
{
array<System::Collections::DictionaryEntry>^ rules =
group->GetConnectAccessRules();
for each (System::Collections::DictionaryEntry^ o in rules)
{
String^ key = (String^)(o->Key);
array<CodeConnectAccess^>^ values = (array<CodeConnectAccess^>^)(o->Value);
Console::WriteLine("Origin scheme: {0}", key);
for each (CodeConnectAccess^ c in values)
{
Console::WriteLine("Scheme {0} Port: {1}", c->Scheme, c->Port);
}
Console::WriteLine("__________________________");
}
}
public static void DisplayConnectionAccessRules(NetCodeGroup group)
{
System.Collections.DictionaryEntry[] rules = group.GetConnectAccessRules();
foreach (System.Collections.DictionaryEntry o in rules)
{
string key = o.Key as string;
CodeConnectAccess[] values = (CodeConnectAccess[]) o.Value;
Console.WriteLine("Origin scheme: {0}", key);
foreach (CodeConnectAccess c in values)
{
Console.WriteLine("Scheme {0} Port: {1}", c.Scheme, c.Port);
}
Console.WriteLine("__________________________");
}
}
備註
在每個字典專案中, Key 屬性值是原始配置,而 Value 屬性值則是相關聯 CodeConnectAccess 對象的陣列。 如果沒有相關聯的 CodeConnectAccess 物件,則 DictionaryEntry.Value 傳回空陣列。