> I want to instantiate a class at runtime that accepts a parameter,
> but I am currently using Assembly.LoadFrom so I am having to do
[quoted text clipped - 3 lines]
> (which isn't a suprise, really) but it there another way I can
> accomplish the same thing?
I'm a bit confused. Assembly.LoadFrom is for loading assemblies, not
instantiating types, correct? Why don't you use Assembly.LoadFrom to
load the assembly, Assembly.GetType() to find the type and then
Activator.CreateInstance() to create an instance of the type using the
correct constructor?

Signature
Best Regards,
Dustin Campbell
Developer Express, Inc
Morgan - 06 Dec 2005 02:08 GMT
Just to add to what Dustin is saying about the constructor, only offering
b/c I spent a couple of hours on this today ;)
In c# it would look something like this..
object[] objectargs = new object{"mystringparam", false, -1}
Activator.CreateInstance(myobjectstring, objectargs)
The parameters passed into the objectargs -must- match by position and type
those expected by the constructor. For example, as I learned today, passing
a StringBuilder to a string param yields a "Method not found" exception.
That's an hour of my life I'd sure like back ;).
--Morgan
>> I want to instantiate a class at runtime that accepts a parameter,
>> but I am currently using Assembly.LoadFrom so I am having to do
[quoted text clipped - 9 lines]
> Activator.CreateInstance() to create an instance of the type using the
> correct constructor?