Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxix Buzz, wwwxxxdbgf, ncurses font size, WWWXXX USABLE, WwwXXX MPEG4, WWWXXX BABBAGE WWWXXX, IIS_asps05kj, WWWXXXDOCO, WWW.XXX,GCDMO, Idl Wwwxxx

Links

XODOX
Impressum

#1: Compiling and Loading C# class on the fly

Posted on 2005-12-20 05:39:02 by RonJames

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

Report this message

#2: Re: Compiling and Loading C# class on the fly

Posted on 2005-12-20 05:51:59 by Truong Hong Thi

Could you post some source of TestCase to demonstrate the problem?

Report this message

#3: Re: Compiling and Loading C# class on the fly

Posted on 2005-12-20 15:37:02 by RonJames

I cleaned up my source code so that I could post it, and I've 'fixed' the
problem. Not sure how yet, but now I'll be able to figure it out.

Thanks for you interest.

"Truong Hong Thi" wrote:

> Could you post some source of TestCase to demonstrate the problem?
>
>

Report this message