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 将返回一个空数组。

适用于