Bewerken

Share via


NetCodeGroup.GetConnectAccessRules Method

Definition

Gets the connection access information for the current code group.

public:
 cli::array <System::Collections::DictionaryEntry> ^ GetConnectAccessRules();
public System.Collections.DictionaryEntry[] GetConnectAccessRules ();
member this.GetConnectAccessRules : unit -> System.Collections.DictionaryEntry[]
Public Function GetConnectAccessRules () As DictionaryEntry()

Returns

A DictionaryEntry array containing connection access information.

Examples

The following code example demonstrates displaying the connection access rules for a NetCodeGroup object.


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("__________________________");
    }
}

Remarks

In each dictionary entry, the Key property value is the origin scheme, and the Value property value is the array of associated CodeConnectAccess objects. If there are no associated CodeConnectAccess objects, DictionaryEntry.Value returns an empty array.

Applies to