Fields Vs Properties
In .NET, we can define attributes of a class as a field like: public class Employee { private System.Int32 employeeId = 0; ... } And if, we want this attribute to be accessed by other clasess, we make it public like : public System.Int32 EmployeeId = 0; We, also have an alternate way of declaring the same thing, as a property like: public class Employee { private System.Int32 employeeId = 0; public System.Int32 EmployeeId { get { return employeeId ; } set { employeeId = value; } } } Now, EmployeeId is a property, which is exposed to other classes. We can think and figure out the difference between the two approaches - of defining it as a public field or a property. If we declare the attribute as a property , we can go ahead and modify the get-set section like: public class Employee { private System.Int32 employeeId = 0; public System.Int32 EmployeeId { get { return employeeId ; } set { if (value>0) { employeeId=value; } } } } What is be