john_smith_lon
john_smith_lon

Reputation: 149

Assembly.Load vs Assembly.LoadFrom Casting (object must implement iconvertible)

I want to load an assembly for the purposes of a plug-in functionality whereby the loaded dll may be reloaded without restarting the application. I understand the easiest way to do this is to load the assembly using:

 Assembly assembly = Assembly.Load(File.ReadAllBytes("myDerivedClass.dll"));

rather than:

Assembly assembly = Assembly.LoadFrom("myDerivedClass.dll");

However, when I used Assembly.Load instead of Assembly.LoadFrom, I get the error

object must implement iconvertible" when executing the following cast:

dynamic classObj = Convert.ChangeType(myBaseClassObject, type);

Any ideas what I am doing wrong / what is different between Load and LoadFrom to give this error?

Upvotes: 0

Views: 100

Answers (0)

Related Questions