日期:2014-05-18 浏览次数:20871 次
using System.Linq; using System.Xml.Linq; string path = "c:\\mm.xml"; Assembly assembly = Assembly.LoadFile("c:\\JRJ.XTrend.Theme.dll"); XElement root = new XElement("Types", assembly.GetTypes().Select(x => new XElement("Type", new XAttribute("Name",x.Name), new XElement("Methods",x.GetMethods().Select(m=>new XElement("Method",new XAttribute("Name",m.Name)))), new XElement("Properties", x.GetProperties().Select(p => new XElement("Property", new XAttribute("Name", p.Name)))), new XElement("Members", x.GetMembers().Select(p => new XElement("Member", new XAttribute("Name", p.Name)))), new XElement("Fields", x.GetFields().Select(p => new XElement("Fields", new XAttribute("Name", p.Name)))), new XElement("Events", x.GetEvents().Select(p => new XElement("Event", new XAttribute("Name", p.Name)))), new XElement("Interfaces", x.GetInterfaces().Select(p => new XElement("Interface", new XAttribute("Name", p.Name))))))); root.Save(path);