Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain in brief about the quicktest professional (qtp) automation object model?

949


What is Associate Repository in QTP 9.2 ?

993


In an interview, what r the general questions asked in SQL which is realted to testing ?pls give me anwser to this question?

1974


Brief the process of testing with UFT?

1051


Explain the concept of object repository & how qtp recognizes objects?

1067


In qtp, how you can use xpath to identify objects?

1045


How to modify object property in qtp ?

976


How many types of object repository in qtp?

1065


PLEASE TELL ME WHEN DO YOU USE THE OBJECT SPY AT RUN TIME

7412


In QTP can we feed the out of one browser(internet explorer) as an input to the another browser(mozilla firefox)? If yes explain how to do it with an example.

2078


Get the count of files of similar types from a folder.

1456


How many types of status are there?

1005


How to use actions in qtp ?

1020


How can you identify the browser and its information using the qtp script?

971


How QTP identify the system time that's changes every seconds?

1013