Difference between Method and Function ?
Difference between Method and Function ?
Is these similar or not ?
Mention some examples for that ...!
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 22, 2013, 10:21 PM EDT
http://www.codeproject.com/Questions/198819/difference-between-method-and-function
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 22, 2013, 10:26 PM EDT
Both are same, there is no difference its just a different term for the same thing in C#.
In object-oriented programming, a method is a subroutine (or procedure or function) associated with a class.
With respect to Object Oriented programming the term "Method" is used, not fuctions.
Regards,
Iftikar
om prakashRank #5,816 · 285 reputationPosted Aug 22, 2013, 10:32 PM EDT
A function allows you to encapsulate a piece of code and call it from other parts of your code. You may very soon run into a situation where you need to repeat a piece of code, from multiple places, and this is where functions come in. In C#, they are basically declared like this:
Abhineet SrivastavaRank #1,890 · 783 reputationPosted Aug 22, 2013, 10:33 PM EDT
Cheers
VulpesRank #55 · 29.2K reputationPosted Aug 23, 2013, 12:20 AM EDT
1. Methods
2. Properties
3. Events
4. Indexers
5. User-defined operators
6. Instance constructors
7. Static constructors
8. Destructors
So, in the context of C#, the correct answer is that a method is a type of function member.
More generally in object oriented programming, a method is a sub-routine which is a member of a class whereas a function is a sub-routine which is not a member of a class.