4.Methods and Functions
4.Methods and Functions
A method is defined with the name of the method, followed by parentheses (). C#
provides some pre-defined methods, which you already are familiar with, such
as Main(), but you can also create your own methods to perform certain actions.
Example
class Program {
static void MyMethod()
{
// code to be executed } }
Create a Method
Example
int MyMethod(int x)
float MyMethod(float x)
double MyMethod(double x, double y)
Recursion method