What is a “method” in C# programming?

783 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

I don’t know C# but I do know. However, I am familiar with Object Orientated Programing.

A property holds key value pairs. Such as `name: “Bob”`

That is a property, it holds a value.

However, if the key is a function (a set of instructions to reuse) then it’s a method. such as `Person.sayHello()`

would print “hello bob”, if I coded the function to that of course.

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