If you don't mind translating to VB.NET, something like this should work
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { // find the type of the item Type itemType = assembly.GetType("MyCustomObjectClass", false); // if we didnt find it, go to the next assembly if (itemType == null) { continue; } // Now create a generic type for the collection Type colType = assembly.GetType("MyCusomgGenericCollection").MakeGenericType(itemType);; IMyCustomInterface result = (IMyCustomInterface)Activator.CreateInstance(colType); break; }
source share