The following code snippet is
private string name; public string Name { get { return name; } set { name = value; } }
equivalent to the following getter and setter in Java:
private String name; public String getName() { return name; } public void setName(String newName) { name = newName; }
In C # 3.0 ahead, you can get the same effect using only the following line:
public string Name { get; set; }
This is called an automatic property in which the compiler creates a fallback private field and getter / setter for this property. Hope this helps.
Liton source share