Tell me one thing a Property CAN DO that a Method CANNOT DO ?
In general, methods represent actions and properties represent data. Properties are meant to be used like fields, meaning that properties should not be computationally complex or produce side effects. When it does not violate the following guidelines, consider using a property, rather than a method, because less experienced developers find properties easier to use.
Here are my thoughts:
A method is a set of statements that is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name.Method take some input as parameters and return the result as a return value.A property is a member of a class which is used to set and get the data from a data field of a class. A property is never used to store data, it just acts as an interface to transfer the data. We use the Properties as they are the public data members of a class, but they are actually special methods called accessors.
A property is a member of a class which is used to set and get the data from a data field of a class. A property is never used to store data, it just acts as an interface to transfer the data. We use the Properties as they are the public data members of a class, but they are actually special methods called accessors.
A method is a set of statements that is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name.
A property is a named attribute of an object. Properties define the characteristics of an object such as Size, Color etc. or sometimes the way in which it behaves. A method is an action that can be performed on objects.
In property we can declare get or set or both values, In method by using those properties we can do the coding.