共用方式為


NetCodeGroup.GetConnectAccessRules 方法

定義

取得目前程式碼群組的連接存取資訊。

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 傳回空陣列。

適用於