Emitting entire class from source

  • Thread starter Thread starter thomas.greenleaf
  • Start date Start date
T

thomas.greenleaf

Some time ago I wrote a simple reflection.emit example where I emitted
an entire assembly based on source code. Now I forgot exactly how and
all examples online deal only with defining a class through reflection
methods, defining a method and then finally emitting IL for that
specific method.

What I had then would take a string such as "namespace someName{class
someTest{public int test(int a, int b){return a+b;}}}" and then
emitting a class which I could use through reflection.

I would like to do that again, but I have been unable to find examples
of doing so.
 
Some time ago I wrote a simple reflection.emit example where I emitted
an entire assembly based on source code. Now I forgot exactly how and
all examples online deal only with defining a class through reflection
methods, defining a method and then finally emitting IL for that
specific method.

What I had then would take a string such as "namespace someName{class
someTest{public int test(int a, int b){return a+b;}}}" and then
emitting a class which I could use through reflection.

I would like to do that again, but I have been unable to find examples
of doing so.

CSharpCodeProvider? That's what I use for similar purposes.
 
Back
Top