3 C# 3.0 Shortcuts

Monday, June 16th, 2008

1. Automatic Properties

Automatic properties provide you with a shorthand for defining a new property. No more do we have to create the private property and then use Getters and Setters to access and set that property. Here’s the old code:
[ASP]
private string _Name;

public string Name
{
get {return _Name;}
set {_Name = value;}
}
[/ASP]

Now here’s the code using automatic properties:
[ASP]
public string Name {get; set;}
[/ASP]

Oh my! How nice is that? The C# compiler creates the Getters and Setters and the private fields for you automagically!

(more…)

mulberry sale spyder womens jacket cheap new balance 574 mulberry outlet cheap new balance 574 arcteryx outlet mulberry sale spyder womens jacket mulberry sale spyder womens jacket mulberry outlet mulberry outlet new balance 574

Popular Articles

Top 10 Commentators


Subscribe to this feed! Subscribe by Email!

Random Bits Podcast

You need to download the Flash player from Adobe

Other Sites