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
how to use the QTP choose the data from oracle? e.g. i input the identity card NO. this will be add new record in the database ,and now i want get this record's prime key.
How QTP support all types of applications (platforms)?
Could i know how how to explain keyword driven framework in interview? If any body knows plz send the explanation.
How Can I find the least value in a bunch of variables using qtp.. E.g.:- A = 210, B = 212, C = 60, D = 111 I don’t want to write bunch of lines for this…. Is there a way to get the result in one line…..
What is difference between shared and local object repository?
Where to use Property Let, Property Get, Property Set in UFT
How many types of parameters are there?
Hi, how can we check or avoid the memory leakage in QTP9.2?
What are the advantages of qtp?
How does you pass optional arguments in qtp?
In a flight window we have to enter the name and meal request for every passenger.In that window if we give Total passengers=1 then the Psngr1 name field and psngr1 meal request field will reflects.if we give Total passengers=2 then Psngr1 name field and psngr1 meal request field,Psngr2 name field and psngr2 meal request field will reflects and so on.if total psngrs=100 then will we capture all the fields for the psngrs to Automate the app how we can handle this scenerio thru Descriptive programming?
Why bpt?
How to find the difference between 2 dates in qtp?
What environment does qtp run in?
how to download mercury qtp9.2 ny internet ?