May be its a duplicate question. I did search about this and referred these Articles
- use of properties vs backing field inside owner class,
- should i prefer properties with or without private fields,
- Properties Matter.
The point i understood was,
- Access like making field read only
- We can include some logics in
- setter/getter used for data binding
What I really want to clear was,
public class Employee {
public string strName;
}
public class Employee {
public string strName {get;set;}
}
My questions:
- Whats the difference between this two implementations
- Is there any place ( i mean actual scenario) where we can justify a need for auto implemented properties instead the first implementation as shown above as first.
UPDATE
I know its a duplicate question and i mentioned it. Please consider my 2nd point in questions i asked. what the answer precisely ? I couldn't understand that.
Whether its a good practice or what is the need if i do not have any logic to set that value ?
Fine thank you all for replying. I got it now clear. Since i am very new i cant grasp it. But now i got the point. Sorry for wasting all your time.