What is a “method” in C# programming?

782 views

I am currently going through “Become a C# Developer” on LinkedIn Learning and watching this course “Understanding C# syntax”, the instructor – Bruce Van Horn – went on to explain properties but he never explained what is a method? I mean, what is a method? What is it used for? How do I know where to look for method?

Is this simply just a word – like in real world – a method to do something? E.g. completing a task using method 1 or method 2?

TL;DR: what is a method? What is it used for? How do I know where to look for method?

Also, I have Googled this using keyword, but no real good explanations come out of it that I understand.

In: Engineering

6 Answers

Anonymous 0 Comments

All the other answers are correct, but they lack the specific information that a method is a *member function of a class*. Other programming languages have things called functions that definitely aren’t methods, for example in C++, int main(int argc, char* argv[]){ return 0;} is a function, but it’s not a method, because there’s no class associated with it. On the other hand, in C# everything is defined within a class, so you cannot define a function that is not a method.

You are viewing 1 out of 6 answers, click here to view all answers.