Public StaticT getinstance<t>(explicitarguments args); // //Summary://creates a new instance of the requested type T using the supplied instance. //Mostly used internally// //Parameters://instance: Public StaticT getinstance<t>(Instance Instance); // //Summary://creates or finds the default instance of the Plugintype// //Parameters://Plugintype: Public Static Objectgetinstance (Type plugintype); // //Summary://creates a new instance of the requested type using the supplied instance. //Mostly used internally// //Parameters://TargetType:// //instance: Public Static Objectgetinstance (Type targetType, Instance Instance);
To create a generic class dynamically with reflection:
var d1 = Type.GetType ("Generictest.taska ' 1"// Generictest was my namespace, add yourstypeof(Item)}; var makeme = D1. MakeGenericType (typeargs); object o = Activator.CreateInstance (makeme);
GetInstance overloads in the StructureMap.dll