System.Security.Policy.CodeGroup.FromXml C# (CSharp) Метод

FromXml() публичный Метод

public FromXml ( SecurityElement e ) : void
e SecurityElement
Результат void
        public void FromXml(SecurityElement e) { }
        public void FromXml(SecurityElement e, PolicyLevel level) { }

Same methods

CodeGroup::FromXml ( SecurityElement e, PolicyLevel level ) : void
CodeGroup::FromXml ( System e ) : void
CodeGroup::FromXml ( System e, System level ) : void

Usage Example

Пример #1
0
        // internal stuff

        internal static CodeGroup CreateFromXml(SecurityElement se, PolicyLevel level)
        {
            string fullClassName = se.Attribute("class");
            string className     = fullClassName;
            // many possible formats
            // a. "FirstMatchCodeGroup"
            // b. "System.Security.Policy.FirstMatchCodeGroup"
            // c. "System.Security.Policy.FirstMatchCodeGroup, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"\r\n           version=\"1\">\r\n   <IMembershipCondition class=\"System.Security.Policy.AllMembershipCondition, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            int n = className.IndexOf(",");

            if (n > 0)
            {
                className = className.Substring(0, n);
            }
            n = className.LastIndexOf(".");
            if (n > 0)
            {
                className = className.Substring(n + 1);
            }
            // much faster than calling Activator.CreateInstance
            switch (className)
            {
            case "FileCodeGroup":
                return(new FileCodeGroup(se, level));

            case "FirstMatchCodeGroup":
                return(new FirstMatchCodeGroup(se, level));

            case "NetCodeGroup":
                return(new NetCodeGroup(se, level));

            case "UnionCodeGroup":
                return(new UnionCodeGroup(se, level));

            default:                     // unknown
                Type      classType = Type.GetType(fullClassName);
                CodeGroup cg        = (CodeGroup)Activator.CreateInstance(classType, true);
                cg.FromXml(se, level);
                return(cg);
            }
        }
All Usage Examples Of System.Security.Policy.CodeGroup::FromXml