Tuesday, 27 April 2010

C# 4 Last Minute Additions

Update: I'm being very anti-Microsoft at the moment because they make it too expensive for me to get an MSDN license to develop at home. In the past, I've been a big fan but I'm going to defect if they continue down the money or nothing path. Until they stop excluding me from their expensive community, I shall sulk and ridicule them. Please read and have a giggle. It's meant in jest.



I love reading Eric Lippert's blog because he is great at explaining complex ideas in an easy way. That is something severely lacking online. He also dishes the news on my latest reading obsession... C# 4.

They have managed to slip in a few extra features last minute in to the next version of the language. He describes them in more details here. The one's I thought were cute and make the language a little more interesting are the goes to --> and is approached by <-- operators used in loop conditions.

The examples given on his blog show them being used like this:

int x = 10;
// this is read "while x goes to zero"
while (x --> 0)
{
Console.WriteLine("x = {0}", x);
}

int x = 10;
// this is read "while zero is approached by x"
while (0 <-- x) { Console.WriteLine("x = {0}", x); }


Interestingly, when I mentioned the last minute additions to a colleague she commented that she hopes they implemented them properly. In C# 3 they snuck in partial methods and auto-properties which I wouldn't want to live without (although I am in Java-land at the moment).

I'm excited about C# 4. Now I just have to get Microsoft to give me a reasonably priced MSDN license for an individual who isn't a student, a company or a start-up. Market gap.

5 comments:

James Webster said...

'Now I just have to get Microsoft to give me a reasonably priced MSDN license for an individual who isn't a student, a company or a start-up. Market gap.'

Here, here! Unfortunately MS answer is probably, "that's what the Express editions are for". But regretably the Express editions are crap.

Ola Bini said...

This is a joke, right?

Damana Madden said...

:o)

Damana Madden said...

It's like the otherwise do something cool operator. I love it :) OK, i'm easily amused but it's funny.

Damana Madden said...

I'm being very anti-Microsoft at the moment because they make it too expensive for me to get an MSDN license to develop at home. In the past, I've been a big fan but I'm going to defect if they continue down the money or nothing path.

Acknowledge Me

Apple started a user experience trend many iOSes ago when it accepted Settings changes and did not ask for confirmation. Once the chang...