Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I recently accepted a job where I will be working with the IL a lot(on the team of a certain obfuscator that's included with Visual Studio).

They know I have little knowlegde of it, so I'll have some time to learn it on the job. But, I want to get a bit of a jump start on it in the interim.

For my background, I've never wrote any IL and read very little of it. I do understand what it is though and such. I know x86 assembly and such as well, so I'm not dumb as far as assembly-type code goes.

But anyway, what are some good ways of getting familiar with IL and learning the usual opcodes and such and also how it's garbage collection and such magically works at an assembly level?

share|improve this question
1  
Implement a simple compiler (e.g., for a subset of Scheme or Pascal), it's the best way of learning a platform. –  SK-logic Jul 30 '12 at 8:51
    
Good point @SK-logic (assuming you "REALLY" want to get to know it. The other only other option I can think of is implement an emulator, but that would be harder than usual with .Net) –  Earlz Jul 30 '12 at 14:45
    
@Earlz, please have a look - meta.stackexchange.com/q/5234/187724 –  Yusubov Aug 3 '12 at 14:48
    
@ElYusubov I know how to accept an answer :P –  Earlz Aug 3 '12 at 16:50

3 Answers 3

up vote 4 down vote accepted

Start with a Book

The Microsoft Press book "Inside Microsoft .NET IL Assembler" is actually excellent reference point to start with. I have read it back 3 years ago, and it was quit a bit interesting. As you may know already, .NET Framework 3.X only adds new classes and functionality. Underlying technology is still the same. So the book still stands, at least until FW3.5.

Side to side to ECMA, and some hard work, you have everything you need.

There are also couple of good articles worth to mention:

share|improve this answer
1  
I think “Inside Microsoft .NET IL Assembler” published in 2002 is only about .Net 1, which means no generics. “Expert .NET 2.0 IL Assembler” from the same author should contain generics, but it's quite expensive. –  svick Jul 28 '12 at 10:16
    
that is right, my main point was starting with a relevant book. –  Yusubov Jul 28 '12 at 13:26

Disassembling some example code seems like a prudent start. Generators (methods that yield) in particular make interesting structures.

Expression Trees, while not directly applicable are maybe a good example step between the language and IL.

Making your own little calculator language/compiler might be a useful example since you've presumably already done a little of that in x86 assembly.

share|improve this answer

Write some code and decompile it with freely available tools. Keep doing this for various high level C# constructs to see how it maps to IL and you're good to go.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.