Beispiel #1
0
    //</Snippet5>
    //<Snippet6>
    // ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a
    // permission with the specified state from the XML encoding.
    private static void ToFromXmlDemo()
    {
        UrlIdentityPermission permIdPerm1 = new UrlIdentityPermission("http://www.fourthcoffee.com/process/*");
        UrlIdentityPermission permIdPerm2 = new UrlIdentityPermission(PermissionState.None);

        permIdPerm2.FromXml(permIdPerm1.ToXml());
        bool result = permIdPerm2.Equals(permIdPerm1);

        if (result)
        {
            Console.WriteLine("Result of ToFromXml = " + permIdPerm2.ToString());
        }
        else
        {
            Console.WriteLine(permIdPerm2.ToString());
            Console.WriteLine(permIdPerm1.ToString());
        }
    }