G
Guest
I'm trying to compile and load a C# source file "on the fly". The Source
file contains a class (TestCase) that derives from TCBase. TCBase is
defined in the TCUtils assembly. My Solution contains 2 project - TCUtils
and the Main line program.
I'm compiling TestCase using CSharpCodeProvider().CreateProvider and
building an in memory assembly. The source file compiles clean.
I then call CreateInstance on the generated assembly using the name
"TestCase" - the derived class that I've compiled on the fly - and store the
result in a base class reference. Console>WriteLine called with the base
class reference displays the class name of the dervied class, so everything
appears to be workign as I had hoped. However, when I invoke a method on the
base class reference, the base class method is called - not the overridden
method on my derived class.
any help would be appreciated.
thanks
file contains a class (TestCase) that derives from TCBase. TCBase is
defined in the TCUtils assembly. My Solution contains 2 project - TCUtils
and the Main line program.
I'm compiling TestCase using CSharpCodeProvider().CreateProvider and
building an in memory assembly. The source file compiles clean.
I then call CreateInstance on the generated assembly using the name
"TestCase" - the derived class that I've compiled on the fly - and store the
result in a base class reference. Console>WriteLine called with the base
class reference displays the class name of the dervied class, so everything
appears to be workign as I had hoped. However, when I invoke a method on the
base class reference, the base class method is called - not the overridden
method on my derived class.
any help would be appreciated.
thanks