Need to understand the benefit of using automatic properties apart from less line of codes?
Intially we used as below :
private int sample;
public int Sample
{ get {return sample};
set {this.sample=value};
}
Now we just get n set it directly.Why we used to define a private variable?
You're still creating a private variable - it's just done for you behind the scenes by the compiler. The variable is given an "unspeakable name", ensuring you can't refer to it in source code.
You're still getting all the benefits of properties (you can later change from an automatic property to a "manual" property, with no compatibility issues) but without all the cruft. The benefit is just that the code ends up being a lot more concise. I regard that as a significant benefit though :)
See more on this question at Stackoverflow