I tested it in VS2010. Which is beautiful by the way, I like the WPF rendering. And I’m happy they didn’t disable the possibility to generate .Net 2.0 assemblies. I wanted to test the new historical debugger functionnality, which enable you to see the state of variable in the past time, but I didn’t take the Team System Edition (and I’m too lazy to download it again).

named and optionnal arguments

I’m so happy Microsoft has created optional and named arguments for method calls. It avoids a lot of stupid method overload. And I just can’t way to be using it in my code.

This is also a good news for people using Interop methods, like the one for Word 2007. I’ve seen a code using them, it looks like that :

object nullObj = null;
object name = "doc.docx";
officeClass.SaveAsWord2007Document( ref name, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj );

With C# 4.0, it could be translated to something like that :

officeClass.SaveAsWord2007Document( "doc.docx" );

The C# 4.0 will convert it to exactly the same IL code internally (creating a refNullObj).

But it’s still just a little COM+ specific feature, you can’t use in Mono/Linux for instance. So I don’t think we can consider it as a real language feature.


I tested DLR with the “dynamic” type, I think it should only be used when we have no other choice (when we want to communicate with some scripting languages for instance). One reason is that it breaks the VS auto-completion, it’s like you were typing your code in notepad. The other reason is that, from my test, dynamic calls are 3 times slower to execute than compiled calls :

static void Main() {
    int nb = 100000000;
    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
    TimeSpan without, with;
    { // Without dynamics
        Console.WriteLine( "Without dynamics..." );
        var c = new Clacla();
        var start = DateTime.Now;
        for ( int i = ; i < nb; ++i ) {
        without = DateTime.Now - start;
        Console.WriteLine( "Elapsed time : {0}", without );
    { // With dynamics
        Console.WriteLine( "With dynamics..." );
        dynamic d = new Clacla();
        var start = DateTime.Now;
        for ( int i = ; i < nb; ++i ) {
        with = DateTime.Now - start;
        Console.WriteLine( "Elapsed time : {0}", with );
    Console.WriteLine( "Dynamics call are {0} times slower.", Math.Round( (double) with.Ticks / without.Ticks, 2 ) );

The result is :

Without dynamics...
Elapsed time : 00:00:14.7285156
With dynamics...
Elapsed time : 00:00:39.8613281
Dynamics call are 2,71 times slower.

Covariance / Contravariance

It will simplify things for sure but I’m a little disappointed by the remaining restrictions.

The best explanation I could find on it so far is here.

C# + IL

I think Microsoft really had a great idea when they created their “Intermediate Language” to split the language from the managed library. Because if Sun had done the same thing you would be able to use enums (which is just an int internally) in an “old” 1.4 JRE.

With C# 4.0, you can still code for “old” .Net 2.0 environnements.