tags:

views:

153

answers:

4

Where can I look to get started with writing MSIL in c#?

+3  A: 

You can start with the Emit namespace MSDN documentation?




Edit by slugster: because this was marked as the answer i have added this link to the doco, hopefully it adds some more substance to the answer:

http://msdn.microsoft.com/en-us/library/8ffc3x75%28v=VS.100%29.aspx

John
It's worth noting that the ability to compile `Expression` trees obviates `Reflection.Emit` in *many* cases. See: http://msdn.microsoft.com/en-us/library/bb397951.aspx
Porges
+5  A: 

Introduction to Microsoft’s IL

Expert .NET 2.0 IL Assembler(Book)

[You can examine your compiled code with an IL viewer like Reflector or ILDASM.Exe

Mitch Wheat
+1 - the best place to start is using ILDASM to view the IL from c# code, then move on to a book.
Donnie
+1  A: 

A nice tool to use is ILIDE#, even though the page is no longer working you can get it from here: http://nida.se/ilide/ILIDE_v3.zip

I used it when I wanted to learn how MSIL work, back when I was doing a little java->MSIL compiler back in Uni.

EDIT:

uh, i forgot to write what it is, well its a IDE for writing, compiling and debugging IL, and if i recall it also has some intellisense, pretty nifty app ;)

Francisco Noriega
A: 

Nice tool is C# compiler. Write some code as a method, compile it and run ildasm on it. If you have SharpDevelop, compile the program and select Tools -> Il Dasm. It runs ildasm and shows MSIL the compiler generated.

Arto Viitanen