In C#, a field is a variable (that can be of any type) that is defined inside a class. It can be used to define the characteristics of an object or a class. On the other hand, a property is a member of the class that provides an abstraction to set (write) and get (read) the value of a private field. https://www.educative.io/answers/what-is-the-difference-between-fields-and-properties-in-c-sharp Generally fields are private, as the point of a property is you have getter and setter code-handled capabilities.
Comments
Post a Comment