Skip to main content
Table of ContentsJump through this article

Up and coming features in C# 3.0

2 min read

I’m personally looking forward to C# 3.0. There are some interesting new things coming to the language. However there are somethings I really don’t like about c# (please pay attention to the end of this video Anders Hejlsberg - Programming data in C# 3.0)

  • Local variable type inference (I personally don’t really like this idea)
  • Extension Methods
  • Lambda expressions
  • Object initializers
  • Collection initializers
  • Query expressions
  • Anonymous types
  • Expression trees
  • Automatic properties

Source: C# 3.0: Upcoming Language Features - Nick Wong

26.1 Implicitly typed local variables

In an implicitly typed local variable declaration, the type of the local variable being declared is inferred from the expression used to initialize the variable. When a local variable declaration specifies var as the type and no type named var is in scope, the declaration is an implicitly typed local variable declaration. For example:

var i = 5;
var s = "Hello";
var d = 1.0;
var numbers = new int[] {1, 2, 3};
var orders = new Dictionary<int,Order>();
The implicitly typed local variable declarations above are precisely equivalent to the following explicitly typed declarations:
int i = 5;
string s = "Hello";
double d = 1.0;
int[] numbers = new int[] {1, 2, 3};
Dictionary<int,Order> orders = new Dictionary<int,Order>();

This reminds me of javascript, and personally I think this is a wrong move for the language because it kind of forces developers to be lazy. Even more so on larger projects could lead to developers that are maintaining code to do extra work just to understand the code. We will just have to wait and see how it turns out.

Download

Watch

C# 3.0: Future Directions in Language Innovation

Blake Niemyjski

Thanks for reading! Feel free to check out more posts or browse by category, and reach out via the social links below.


More Posts

Assembly Language Is FUN

1 min read
Programming

I started this semester with a bunch of classes. But the one I’m most passionate about is CPS 260 Assembly Language. Ever since I was about 12 I always wanted to learn assembly language. Now I’m…

Christmas 2006 News

1 min read
Programming

I would like to inform everyone who reads these blogs, that during Christmas break; I will be releasing an update to FirefoxToIE7, an Office 2007 application, and three other stand alone…


Comments