specifying an assembly for createInstance

  • Thread starter Thread starter D Yee
  • Start date Start date
D

D Yee

HI all,

So the CF does not support Activator.CreateInstance where you can specify an
assembly. How are you supposed to create an instance that's not in your
assembly?
 
Two ways.
1) Use Assembly.LoadFrom (path) to load the assembly, then Assembly.GetType
to get an instance of type
2) If the assembly is in GAC or already loaded, use
Type.GetType("<typename>, <assemblyname>")

Type tRect = Type.GetType("System.Drawing.Rectangle, System.Drawing");
 
Back
Top