Sunday, September 28, 2008

C# 3.0 Getter and Setter property

I am reading 'C# in Depth' by Jon Skeet. I am loving this book because this book has presented the evolution of codes in different versions of C#.
I was excited to learn about this cool time saving feature.
In C# 3.0 Property, we dont have to declare a member variable to create a property and we can use getter as public and set the setter as private in Property initialization. The following code will create a property Name in c# 3.0

public String Name
{
get;
private set;
}