The language is made smart, and I can’t resist also pointing out a new ingenious language feature of C# 3.0 introduced to me at MSDN Live.
var result = new {myText="some string", myInteger=12345, myClass=new MyClass()}
The code snippet will create an instance with these three properties, implicitly declared public as a string, an integer and an object of type MyClass. Of course, Visual Studio 2008 provides auto completion for accessing these properties.
string theText = result.myText
MyClass myClass = result.myClass
It solves neatly the problem of temporary storage of data in a method. You won’t have to declare any more temporary class to store the data. Sweet! :)
Read this article for a preview of what more to come with C#3.0. By the way, wonder why they had to make the version numbers of .Net and C# so confusing? To use C# 3.0, you need .Net 3.5, not .Net 3.0. Oh well. It ships with Visual Studio 2008)