Reflection

cel

Newcomer
Joined
Jun 24, 2003
Messages
13
Here's what I want to do,

I have a compiled assembly of code, which I've used:
Visual Basic:
myCodeCompiler = dynCompiler.CreateCompiler()
myCompilerResults = myCodeCompiler.CompileAssemblyFromFileBatch(myCompilerParameters, files)

Now that I have all of my various files compiled at runtime, I want to throw the code into a parent class. So I have the functionality of being able to write functions/procedures in my files and not have to create a class for them.
 
I really doubt this is difficult for anyone familiar with reflection.

I just want to force a class to be a subclass of a different class.
 
It's not going to happen. Reflection doesn't work that way. Once you've compiled your assembly there is no longer any code to modify, and why would you want to make a class suddenly be a subclass of a different class?
 
I know it can work, I've seen it done, although I'm not sure how

"functionality of being able to write functions/procedures in my files and not have to create a class for them."
 
You need to create the class programmatically and insert your functionality into the class, and compile the whole thing at once. You can't just inject your code into the compiled DLL.
 
Back
Top