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;
}