public static IEnumerable<T> GetEnumerableOfType<T>(Assembly assembly = null, params object[] constructorArgs) where T : class
{
List<T> objects = new List<T>();
foreach (Type type in (assembly ?? Assembly.GetAssembly(typeof(T))).GetTypes()
.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(T))))
{
objects.Add((T)Activator.CreateInstance(type, constructorArgs));
}
return objects;
}