Click here to Skip to main content
15,912,507 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
What is the difference between Methods and Property?
Please be specific, How they differ from each other?
Posted

"Methods" is a work in the plural form, "Property" is in singular. What do you want one-to-many or many-to-one comparison? :-). If you still did not get a hint: the questions "What's the difference between {0} and {1}" are not correct. Learn both and see by yourself, don't be too lazy. You need to learn concepts, not compare them. I really don't care if this is the question posed at your school or at an interview. I can help learning, not answering incorrect questions.

If this is still not enough, read this: http://msdn.microsoft.com/en-us/library/x9fsa0sw.aspx[^] and this: http://msdn.microsoft.com/en-us/library/ms173114%28v=vs.80%29.aspx[^]. Nothing is more specific than this. :-)

—SA
 
Share this answer
 
A property is not at all like a method as there are two different code sections defined. One for reading or retrieving the propertie's value and one for writing or assigning to it.

A method can have a return type of void whereas a property cannot be of type void. The get part of a property is always liken to a parameterless method whereas the set part of a property is like a method that has one parameter (value).

In methods it is generally acceptable behaviour if two calls with the same parameter yield different results. In properties this only applicable to the reading part of the property.

Cheers!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900