Skip to content

Instantly share code, notes, and snippets.

@BlackPrincess
Created April 23, 2013 04:29
Show Gist options
  • Save BlackPrincess/5440857 to your computer and use it in GitHub Desktop.
Save BlackPrincess/5440857 to your computer and use it in GitHub Desktop.
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(assem => assem.GetTypes()
.Select(t => t)
.Where(t => t.FullName.Contains("Namespace.Foo"))
.Where(t => Attribute.GetCustomAttributes(t, typeof(BarAttribute)).Length > 0)
.Select(t => t)
);
foreach(Type typ in types)
{
var instance = Activator.CreateInstance(typ);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment