Dynamic Casting
-
I've load an assembly with Reflection , I have a class named
Agent
which is in assembly , and I've create an instance of it withCreateInstance()
, but I can't cast it to its interface(IAgent
) , do you have any idea about this dynamic casting in C#(.net 2)?. ThanksMazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji -
I've load an assembly with Reflection , I have a class named
Agent
which is in assembly , and I've create an instance of it withCreateInstance()
, but I can't cast it to its interface(IAgent
) , do you have any idea about this dynamic casting in C#(.net 2)?. ThanksMazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - BabujiMazdak wrote:
I can't cast it to its interface
What exactly does that mean? Are you getting an exception at runtime (what does it tell you) or maybe a compiler error? Furthermore it would be helpful to post a small snippet with the relevant code so we are able to see what exactly you're trying to do.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook