What is the difference between property and method?
Answer Posted / ravi
Properties are a useful way of expressing a feature of an object, allowing get/set in a common way that can be used by APIs like data-binding, reflection and serialization. So for simple values of the object, properties are handy. Properties can't take arguments, should not have significant side-effects*, and should return quickly and repeatably. Also, there is no such thing as an "extension property" (to mirror an extension method) nor a generic property.
(*=lazy loading etc isn't uncommon, however)
Methods (C# doesn't have functions) are better for expressing things that either change the state, or which have an expectation of taking some time and not necessarily being reproducible. They don't tend to work in binding / serialization etc.
Note that properties are actually just a special way of writing methods. There is little functional difference. It is all about expressing intent. The one thing you don't want to expose, however, is fields (the actualintEmployeeAge instance variable).
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is TOM in QTP?
How software automation specialist enter steps in the Expert View?
What if recovery scenarios is also failed for identify the alert ? (We are handling unexpected popup through recovery scenarios but if still recovery scenarios also failed than what should be the approach)
How to use conditional loops in qtp ?
Where you are storing your script?
Hi friends did any budy attend accenture system test for qtp? if any budy pls drop questions.not only accenture any other mnc company which you attended system test(QTP)?it may helpful to others also
what is the diffrence bw qtp architectute and qtp framework?
How do we analyze the checkpoint results?
hi nani my doubt is how does qtp process metrix related to software process.
what is Property......End Property loop? how to write sript for it in QTP
Hi all can any one give me roles and responsibilities for QTP (not WINRUNNER)
What is text check point and text area check point?
Explain how Selenium is different from UFT?
Explain different types of action in qtp?
How do you perform Regreession Testing?