First Class
class Example
{
public int ID
{
get;
set;
}
}
{
public int ID
{
get;
set;
}
}
second Class
class Example
{
private int _id;
public int Id
{
get
{
return _id;
}
set
{
_id = value;
}
}
}
{
private int _id;
public int Id
{
get
{
return _id;
}
set
{
_id = value;
}
}
}
what will be difference Between Property


Pranay RanaRank #735 · 3.2K reputationPosted Apr 22, 2015, 1:04 AM EDT
Where as second property declaration is according to old C# syntax before C#3.0 release.
Both of the property will work same. its just syntax difference.
You can read here : http://weblogs.asp.net/dwahlin/c-3-0-features-automatic-properties
Lalit RaghavRank #1,306 · 1.3K reputationPosted Apr 22, 2015, 2:14 AM EDT