private void GetTypeMethods(List <MemsInfo> tmp, Type type, bool isstatic) { if (type.IsClass) { foreach (var item in (from p in type.GetMethods() where p.IsStatic == isstatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0 || item.Name.IndexOf("add_") == 0 || item.Name.IndexOf("remove_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } if (type.BaseType != null) { GetTypeMethods(tmp, type.BaseType, isstatic); } } }
private void GetTypeMethods(List <MemsInfo> tmp, Type type, bool isstatic) { if (type.IsClass) { if (isstatic) { foreach (var item in (from p in type.GetMethods() where p.IsStatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0) { continue; } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); if (tmp.Find(p => p.type == method.type) == null) { tmp.Add(method); } } } } else { foreach (var item in (from p in type.GetMethods() where p.IsStatic == false && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0) { continue; } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); if (tmp.Find(p => p.type == method.type) == null) { tmp.Add(method); } } } } if (type.BaseType != null) { GetTypeMethods(tmp, type.BaseType, isstatic); } } }
private List <MemsInfo> GetTypeMethods(Type type, bool isstatic) { if (!typeMethods.ContainsKey(type)) { List <MemsInfo> tmp = new List <MemsInfo>(); if (type.IsClass) { foreach (var item in (from p in type.GetMethods() where p.IsStatic == isstatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0 || item.Name.IndexOf("add_") == 0 || item.Name.IndexOf("remove_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } } tmp.Sort((a, b) => a.Name.CompareTo(b.Name)); typeMethods[type] = tmp; return(tmp); } else { return(typeMethods[type]); } }
private List <MemsInfo> GetTypeMembers(Type type, bool isStatic) { if (!typeMembers.ContainsKey(type)) { List <MemsInfo> tmp = new List <MemsInfo>(); if (type.IsEnum) { foreach (var item in type.GetEnumNames()) { tmp.Add(new MemsInfo(item, type.Name + "." + item, "Is Enum")); } } else if (type.IsClass) { if (isStatic) { foreach (var item in (from p in type.GetMethods() where p.IsStatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0 || item.Name.IndexOf("add_") == 0 || item.Name.IndexOf("remove_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } } foreach (var item in (from p in type.GetProperties() select p)) { if (tmp.Find(p => p.Name == item.Name) == null) { tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Properties")); } } foreach (var item in (from p in type.GetEvents() select p)) { if (tmp.Find(p => p.Name == item.Name) == null) { tmp.Add(new MemsInfo(item.Name, item.EventHandlerType.ToString() + "\r\n:Add(fuction(...){})+\r\n" + GetGetMethodstr(item.EventHandlerType), "Is Events")); } } foreach (var item in (from p in type.GetFields() where p.IsStatic == isStatic && p.IsPublic select p)) { if (tmp.Find(p => p.Name == item.Name) == null) { tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Field")); } } if (type.BaseType != null) { GetTypeMembers(tmp, type.BaseType, isStatic); } } tmp.Sort((a, b) => a.Name.CompareTo(b.Name)); typeMembers[type] = tmp; return(tmp); } else { return(typeMembers[type]); } }
private void GetTypeMembers(List <MemsInfo> tmp, Type type, bool isStatic) { if (type.IsEnum) { foreach (var item in type.GetEnumNames()) { tmp.Add(new MemsInfo(item, type.Name + "." + item, "Is Enum")); } } else if (type.IsClass) { foreach (var item in (from p in type.GetMethods() where p.IsStatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } foreach (var item in (from p in type.GetProperties() select p)) { if (tmp.Find(p => p.Name == item.Name) == null) { tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Properties")); } } if (isStatic) { foreach (var item in (from p in type.GetFields() where p.IsStatic && p.IsPublic select p)) { if (tmp.Find(p => p.Name == item.Name) == null) { tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Field")); } } } else { foreach (var item in (from p in type.GetFields() where p.IsStatic == false && p.IsPublic select p)) { if (tmp.Find(p => p.Name == item.Name) == null) { tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Field")); } } } if (type.BaseType != null) { GetTypeMembers(tmp, type.BaseType, isStatic); } } }
private List<MemsInfo> GetTypeMembers(Type type,bool isStatic) { if (!typeMembers.ContainsKey(type)) { List<MemsInfo> tmp = new List<MemsInfo>(); if (type.IsEnum) { foreach (var item in type.GetEnumNames()) { tmp.Add(new MemsInfo(item, type.Name + "." + item, "Is Enum")); } } else if (type.IsClass) { if (isStatic) { foreach (var item in (from p in type.GetMethods() where p.IsStatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0 || item.Name.IndexOf("add_") == 0 || item.Name.IndexOf("remove_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } } foreach (var item in (from p in type.GetProperties() select p)) { if (tmp.Find(p => p.Name == item.Name) == null) tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Properties")); } foreach (var item in (from p in type.GetEvents() select p)) { if (tmp.Find(p => p.Name == item.Name) == null) tmp.Add(new MemsInfo(item.Name, item.EventHandlerType.ToString()+"\r\n:Add(fuction(...){})+\r\n" + GetGetMethodstr(item.EventHandlerType), "Is Events")); } foreach (var item in (from p in type.GetFields() where p.IsStatic==isStatic && p.IsPublic select p)) { if (tmp.Find(p => p.Name == item.Name) == null) tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Field")); } if (type.BaseType != null) GetTypeMembers(tmp, type.BaseType, isStatic); } tmp.Sort((a, b) => a.Name.CompareTo(b.Name)); typeMembers[type] = tmp; return tmp; } else { return typeMembers[type]; } }
private List<MemsInfo> GetTypeMethods(Type type,bool isstatic) { if (!typeMethods.ContainsKey(type)) { List<MemsInfo> tmp = new List<MemsInfo>(); if (type.IsClass) { foreach (var item in (from p in type.GetMethods() where p.IsStatic == isstatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0 || item.Name.IndexOf("add_") == 0 || item.Name.IndexOf("remove_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } } tmp.Sort((a, b) => a.Name.CompareTo(b.Name)); typeMethods[type] = tmp; return tmp; } else { return typeMethods[type]; } }
private void GetTypeMethods(List<MemsInfo> tmp, Type type, bool isstatic) { if (type.IsClass) { foreach (var item in (from p in type.GetMethods() where p.IsStatic == isstatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0 || item.Name.IndexOf("add_") == 0 || item.Name.IndexOf("remove_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } if (type.BaseType != null) GetTypeMethods(tmp, type.BaseType, isstatic); } }
private void GetTypeMembers(List<MemsInfo> tmp,Type type, bool isStatic) { if (type.IsEnum) { foreach (var item in type.GetEnumNames()) { tmp.Add(new MemsInfo(item, type.Name + "." + item, "Is Enum")); } } else if (type.IsClass) { foreach (var item in (from p in type.GetMethods() where p.IsStatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0) { continue; } else { MemsInfo x = null; if ((x = tmp.Find(p => p.Name == item.Name)) != null) { x.type += "\r\n" + item.ToString(); } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); tmp.Add(method); } } } foreach (var item in (from p in type.GetProperties() select p)) { if (tmp.Find(p => p.Name == item.Name) == null) tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Properties")); } if (isStatic) { foreach (var item in (from p in type.GetFields() where p.IsStatic && p.IsPublic select p)) { if (tmp.Find(p => p.Name == item.Name) == null) tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Field")); } } else { foreach (var item in (from p in type.GetFields() where p.IsStatic == false && p.IsPublic select p)) { if (tmp.Find(p => p.Name == item.Name) == null) tmp.Add(new MemsInfo(item.Name, item.ToString(), "Is Field")); } } if (type.BaseType != null) GetTypeMembers(tmp, type.BaseType, isStatic); } }
private void GetTypeMethods(List<MemsInfo> tmp, Type type, bool isstatic) { if (type.IsClass) { if (isstatic) { foreach (var item in (from p in type.GetMethods() where p.IsStatic && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0) { continue; } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); if (tmp.Find(p => p.type == method.type) == null) tmp.Add(method); } } } else { foreach (var item in (from p in type.GetMethods() where p.IsStatic == false && p.IsPublic select p)) { if (item.Name.IndexOf("get_") == 0 || item.Name.IndexOf("set_") == 0) { continue; } else { MemsInfo method = new MemsInfo(item.Name, item.ToString(), "Is Method"); if (tmp.Find(p => p.type == method.type) == null) tmp.Add(method); } } } if (type.BaseType != null) GetTypeMethods(tmp, type.BaseType, isstatic); } }