Пример #1
0
        protected override void AddExtraData(XmlNode p, MemberInfo member)
        {
            base.AddExtraData(p, member);

            ParameterData parms = new ParameterData(document, p,
                                                    ((MethodBase)member).GetParameters());

            parms.DoOutput();

            if (!(member is MethodBase))
            {
                return;
            }

            MethodBase mbase = (MethodBase)member;

            if (mbase.IsAbstract)
            {
                AddAttribute(p, "abstract", "true");
            }
            if (mbase.IsVirtual)
            {
                AddAttribute(p, "virtual", "true");
            }
            if (mbase.IsStatic)
            {
                AddAttribute(p, "static", "true");
            }

            if (!(member is MethodInfo))
            {
                return;
            }

            MethodInfo method = (MethodInfo)member;

            AddAttribute(p, "returntype", method.ReturnType.ToString());

            AttributeData.OutputAttributes(document, p,
                                           method.ReturnTypeCustomAttributes.GetCustomAttributes(false));
#if NET_2_0
            // Generic constraints
            Type []    gargs    = method.GetGenericArguments();
            XmlElement ngeneric = (gargs.Length == 0) ? null :
                                  document.CreateElement("generic-method-constraints");
            foreach (Type garg in gargs)
            {
                Type [] csts = garg.GetGenericParameterConstraints();
                if (csts.Length == 0 || csts [0] == typeof(object))
                {
                    continue;
                }
                XmlElement el = document.CreateElement("generic-method-constraint");
                el.SetAttribute("name", garg.ToString());
                el.SetAttribute("generic-attribute",
                                garg.GenericParameterAttributes.ToString());
                ngeneric.AppendChild(el);
                foreach (Type ct in csts)
                {
                    XmlElement cel = document.CreateElement("type");
                    cel.AppendChild(document.CreateTextNode(ct.FullName));
                    el.AppendChild(cel);
                }
            }
            if (ngeneric != null && ngeneric.FirstChild != null)
            {
                p.AppendChild(ngeneric);
            }
#endif
        }
Пример #2
0
        protected override void AddExtraData(XmlNode p, MemberInfo member)
        {
            base.AddExtraData (p, member);

            ParameterData parms = new ParameterData (document, p,
                ((MethodBase) member).GetParameters ());
            parms.DoOutput ();

            if (!(member is MethodBase))
                return;

            MethodBase mbase = (MethodBase) member;

            if (mbase.IsAbstract)
                AddAttribute (p, "abstract", "true");
            if (mbase.IsVirtual)
                AddAttribute (p, "virtual", "true");
            if (mbase.IsStatic)
                AddAttribute (p, "static", "true");

            if (!(member is MethodInfo))
                return;

            MethodInfo method = (MethodInfo) member;
            AddAttribute (p, "returntype", method.ReturnType.ToString ());

            AttributeData.OutputAttributes (document, p,
                method.ReturnTypeCustomAttributes.GetCustomAttributes (false));
            #if NET_2_0
            // Generic constraints
            Type [] gargs = method.GetGenericArguments ();
            XmlElement ngeneric = (gargs.Length == 0) ? null :
                document.CreateElement ("generic-method-constraints");
            foreach (Type garg in gargs) {
                Type [] csts = garg.GetGenericParameterConstraints ();
                if (csts.Length == 0 || csts [0] == typeof (object))
                    continue;
                XmlElement el = document.CreateElement ("generic-method-constraint");
                el.SetAttribute ("name", garg.ToString ());
                el.SetAttribute ("generic-attribute",
                    garg.GenericParameterAttributes.ToString ());
                ngeneric.AppendChild (el);
                foreach (Type ct in csts) {
                    XmlElement cel = document.CreateElement ("type");
                    cel.AppendChild (document.CreateTextNode (ct.FullName));
                    el.AppendChild (cel);
                }
            }
            if (ngeneric != null && ngeneric.FirstChild != null)
                p.AppendChild (ngeneric);
            #endif
        }