public static SwitchAttribute [] GetAll (Assembly assembly) { object [] atts = assembly.GetCustomAttributes (typeof (SwitchAttribute), false); SwitchAttribute [] ret = new SwitchAttribute [atts.Length]; for (int i = 0; i < atts.Length; i++) ret [i] = (SwitchAttribute) atts [i]; return ret; }
public static SwitchAttribute [] GetAll(Assembly assembly) { object [] atts = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); SwitchAttribute [] ret = new SwitchAttribute [atts.Length]; for (int i = 0; i < atts.Length; i++) { ret [i] = (SwitchAttribute)atts [i]; } return(ret); }
public static SwitchAttribute[] GetAll(Assembly assembly) { if (assembly == null) throw new ArgumentNullException("assembly"); ArrayList switchAttribs = new ArrayList (); object[] attribs = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); switchAttribs.AddRange(attribs); Type[] types = assembly.GetTypes(); for (int i=0; i<types.Length; i++) GetAllRecursive(types[i], switchAttribs); SwitchAttribute[] ret = new SwitchAttribute[switchAttribs.Count]; switchAttribs.CopyTo(ret, 0); return ret; }
public static SwitchAttribute[] GetAll(Assembly assembly) { if (assembly == null) throw new ArgumentNullException(nameof(assembly)); List<object> switchAttribs = new List<object>(); object[] attribs = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); switchAttribs.AddRange(attribs); foreach (Type type in assembly.GetTypes()) { GetAllRecursive(type, switchAttribs); } SwitchAttribute[] ret = new SwitchAttribute[switchAttribs.Count]; switchAttribs.CopyTo(ret, 0); return ret; }
public static SwitchAttribute[] GetAll(Assembly assembly) { if (assembly == null) { throw new ArgumentNullException("assembly"); } ArrayList switchAttribs = new ArrayList(); object[] customAttributes = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); switchAttribs.AddRange(customAttributes); Type[] types = assembly.GetTypes(); for (int i = 0; i < types.Length; i++) { GetAllRecursive(types[i], switchAttribs); } SwitchAttribute[] array = new SwitchAttribute[switchAttribs.Count]; switchAttribs.CopyTo(array, 0); return(array); }
public static SwitchAttribute[] GetAll(Assembly assembly) { if (assembly == null) { throw new ArgumentNullException(nameof(assembly)); } List <object> switchAttribs = new List <object>(); object[] attribs = assembly.GetCustomAttributes(typeof(SwitchAttribute), false); switchAttribs.AddRange(attribs); foreach (Type type in assembly.GetTypes()) { GetAllRecursive(type, switchAttribs); } SwitchAttribute[] ret = new SwitchAttribute[switchAttribs.Count]; switchAttribs.CopyTo(ret, 0); return(ret); }