posted 5 years ago
(1) One important design principle is that you never expose fields as public, but rather always access everything via properties. This is because you can never tell when a field is accessed and more importantly when it is set.
(2) Now, a lot of the time, there isn't any processing needed while setting or getting the value (for example, range checking).
This is why Automatic Properties were created.
(3) In c#, a property is called as an auto-implemented property when it contains an accessors (get, set) without having any logic implementation.
(4) They are a simple, one-line way of creating a property. The backing store for it is created by the compiler.
(5) If you use an Automatic Property and later decide that you need to do something else in the set or get, you can easily change your code without breaking the public interface
(6) Automatic Properties are used when no additional logic is required in the property accessors..
Syntax::
They are just syntactic sugar so need not to write the following lengthy code:
.NET Developer at iFour Technolab Pvt LTd