Why we need Properties in C#

Short answer: Encapsulation

Long answer: Properties are very versitile. It allows you to choose how you want to expose your data to outside objects. You can inject some amount of data validation when setting values. It also aliviates the headache of getX() and setX() methods seen in the likes of Java, etc.

Leave a Comment