IL

IL perversions: throwing and catching strings

Inspired by Mohamed Mahmoud’s blog posting How to: Create Interfaces with Static Methods via IL? I wrote another sick example on IL (Intermediate Language) to show you how different is the world behind compilers. Tonight I have enough of exceptions, I want to throw some strings! Let’s do it!

Expert .NET 2.0 IL Assembler

If you want to know how .Net Framework works internally then there is very good book by Serge Lidin – Expert .NET 2.0 IL Assembler. Serge Lidin is author of IL Assembler, IL Disassembler. He is also one of those guys who wrote IL Assembler language specification. So I think he knows the topic very well.

C# and Partial Classes

.Net 2.0 provided us with new feature called partial classes. Using partial classes we can use multiple files to keep the code of same class. Yes – we can put some methods to one file and the others to another file. Although partial classes may be extremely useful they can be also used to ruin system’s technical design if developers don’t know what happens behind the compiler.

C# and anonymous types

One cool feature of C# 3.0 is support of anonymous types. Let’s suppose we have to create some data structure and we need this structure in one place in one method. This far we had to create a new private class or structure. With anonymous types we don’t have to define new type – we can create it on the run.

C# and var keyword

C# 3.0 introduced us new language feature: type inference using keyword var. Some guys think that var in C# is same thing as var in PHP. That’s wrong – var keyword in C# is totally different thing and it doesn’t mean that C# has now support for type changing class attributes. Let’s prove it.

C# and question marks

One cool operators that C# offers us is ?? But before ?? we should know what does ? after variable type name. So, let’s take both of these question marks and let’s see what they are. Also let’s jump for a while behind compilator to see IL code that compiler produces.

Extension methods – how they look like after compiling

This blog entry is supposed to be the continuation for entry C# Extension Methods where I told what extension methods are and how to use them. This time I will tell about what they are behind the curtains. Do they really add new methods to current classes or not? I mean, are these methods really added to classes or are they something else?