Hey Compiler Team -- Make My Life Easier

The local Bellingham .NET User Group was blessed by having a speaker from the Microsoft C# compiler team visit and tell us about C# 4.0. One of the things that she kept repeating was that "fill in new feature" was done to save typing. Here is my suggestion for a language change: I do a lot of this: public class X { private int _id; public X(int id) { _id = id; } } Most of the time I have several overloads of the constructor, wouldn't it be nice if I could just write this: public class X { private int _id; public X(int _id) {} } If the compiler sees a variable in the constructor with the same names as a member variable of the class (an illegal syntax already) it would know that I want to assign the member variable automatically. The compiler already has to check for conflicts, so it is doing most of the work already. And it you didn't want this to happen, you could just change the variable name to be unique to the local and class scope. {6230289B-5BEE-409e-932A-2F01FA407A92}

Comments

Popular posts from this blog

Simple WP7 Mango App for Background Tasks, Toast, and Tiles: Code Explanation

Yet once more into the breech (of altered programming logic)

How to convert SVG data to a Png Image file Using InkScape