How to write Properties ( get, set ) in C#? and wher we can
How to write Properties ( get, set ) in C#? and wher we can write that one and what the use of that one?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sunny SharmaRank #223 · 11.1K reputationPosted Jul 23, 2013, 10:11 PM EDT
{get; set;} is a replacement for traditional Getter and Setter methods in C#;
You use it while defining properties of a class, like:
---------------------------------------
public class Car{
public Car();
public string Name {get; set;}
public string Type {get;set;}
}
---------------------------------------
You can see above we have two properties of Car and C# will create a private field for them automatically. You don't need to write any Getter and Setter code on your own.
Hope you got the point.
Happy Coding.
Cheers!
Riyaz AkhtarRank #2,275 · 619 reputationPosted Jul 23, 2013, 10:45 PM EDT
http://www.dotnetperls.com/property
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 23, 2013, 10:53 PM EDT
http://www.c-sharpcorner.com/UploadFile/rajeshvs/PropertiesInCS11122005001040AM/PropertiesInCS.aspx
http://csharp-station.com/Tutorial/CSharp/Lesson10