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 RanaPosted Apr 22, 2015, 5:04 AM
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 RaghavPosted Apr 22, 2015, 6:14 AM