Groups | Blog | Home
all groups > dotnet framework > june 2007 >

dotnet framework : Emitting entire class from source


thomas.greenleaf NO[at]SPAM gmail.com
6/14/2007 2:11:03 PM
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.
Jon Skeet [C# MVP]
6/14/2007 10:38:39 PM
[quoted text, click to view]

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

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
AddThis Social Bookmark Button