……………….లో ఒక తెలు’గోడు’…

C# 3.0 new features

Posted by paanis పై మార్చి 24, 2007

C# 3.0 Features: Automatic Property

I am super excited with the Orcas March 2007 CTP release. I was doing the hands on with the C# and LINQ and as you know C# 3.0 comes with a lot of new things which increases the level of abstraction for the developer. We now write less and do more. As I often have mentioned in my previous entries and presentations with Microsoft Partner that now have think more on why not on how. I remember the day when I first learned the Property. I used to scratch my head on what to do with get or set. I probably started it now as we have snippet for property. Anyways in conventional way we declare property in a class like


public class Customer{    public Customer() { } 

    private int _CustID; 

    public int CustID    {        get { return _CustID; }        set { _CustID = value; }    }                 } 

Now C# 3.0 suggests us not to invest so much. Rather than using property like


private int _CustID; 

public int CustID{    get { return _CustID; }    set { _CustID = value; }}     

We can declare property like


public int CustID{    get;    set;} 

No more private variable or = or value etc required. This is Automatic property in C# 3.0.


original post:



Please log in using one of these methods to post your comment:

వర్డ్‌ప్రెస్.కామ్ లోగో

You are commenting using your account. నిష్క్రమించు /  మార్చు )

గూగుల్ చిత్రం

You are commenting using your Google account. నిష్క్రమించు /  మార్చు )

ట్విటర్ చిత్రం

You are commenting using your Twitter account. నిష్క్రమించు /  మార్చు )

ఫేస్‌బుక్ చిత్రం

You are commenting using your Facebook account. నిష్క్రమించు /  మార్చు )

Connecting to %s

%d bloggers like this: