Reflection

cel

Member
Joined
Jun 24, 2003
Messages
13
Heres what I want to do,

I have a compiled assembly of code, which Ive used:
Code:
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.
 
Its not going to happen. Reflection doesnt work that way. Once youve 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, Ive seen it done, although Im 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 cant just inject your code into the compiled DLL.
 
Back
Top