What is a Method?
A method is a block of code which only runs when it is called. You can pass data, known as parameters, into a method.
Defining a Method
csharp static void MyMethod() { Console.WriteLine("I just got executed!"); }
Calling a Method
Inside Main:
csharp
static void Main(string[] args)
{
MyMethod();
}
Note: static means the method belongs to the class, not an object. void means it doesn't return a value.