The one operator I want to see in C#: ?.

As Eric Lippert published the April Fool post for new operators –> and <– in C#, the old idea of ?. came back to me.
The dilemma
I’ve been considering this for some time, and I’m half-serious when suggesting this. C# already has the great null coalescing operator ?? that allows me to treat nulls with ease. [...]

April 5, 2010  Tags:   Posted in: .NET  4 Comments

What’s new in .NET 4.0? (in Finnish)

Just a quick heads-up for my countrymen reading this: I have written and published an 18-page white paper on “What’s new in .NET 4.0” (including changes in C# 4.0 and Visual Basic 2010). Unfortunately for the international audience, the article is written in Finnish. Available on the ITpro.fi web site. Enjoy!

December 4, 2009  Tags: , ,   Posted in: .NET  3 Comments

Collection initialization is not construction

The ability to initialize collections is a great feature of C# 3.0, but it may not work exactly as you expected.
Consider the following class:
internal class MyListContainer
{
internal List<object> MyObjects { get; set; }
}
Now, imagine a call site that does the following:
MyListContainer mlc = new MyListContainer
{
MyObjects = { DateTime.Now, new [...]

September 16, 2009  Tags:   Posted in: .NET  No Comments

Why should you attack incorrect parameter name casing now?

Who cares if your C# method parameters are called “int customerId”, “int CustomerID” or whatever? Well, soon you will!
For the short history of C#, method parameter names have been like private variables to C# developers: Their names don’t make a difference and can be changed at any time.
Yet technically, changing method argument names is an [...]

September 7, 2009  Tags: ,   Posted in: .NET  No Comments

C# partial methods to the limelight!

C# 2.0 and Visual Studio 2005 introduced partial classes to the C# language. In the same rush partial methods appeared, but they have been far less heard of. What’s with those?
Background: Partial classes
Partial classes are a big part of the background for partial methods, so a short recap is in order. Skip to the next [...]

July 6, 2009  Tags: , ,   Posted in: .NET  No Comments