In Which cases we can use get and set and How to use just one of them in programs?
Joe Wilson
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Apr 28, 2014, 1:33 AM
Agreee with Vulpes
When you are writing get and set with property is called Auto-Implemented Properties which is introduced in C#3.0. This is used when no additional logic required in the property accessors.
private string _name;
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
equivalent to....
public string Name { get; set; }
hope this will help you.
VulpesPosted Apr 27, 2014, 2:55 PM