Method Parameters in C#
A method invocation creates a copy, It specifies the invocation of the formal parameters and local variables of that method. The actual argument list of the invocation assigns value or variable references to the newly created formal parameters. Within the body of a method, formal parameters can be used like any other variable.
The invocation involves not only passing the values into the method but also getting back the results from the method. In C#, there are for kinds of Method Parameters:
1. Value Parameters
2. Output Parameters
3. Reference Parameters
4. Parameter Arrays
Value Parameters: Value Parameters are used for passing parameters into methods by value.
Output Parameters: Output Parameters are used to pass results back from a method.
Reference Parameters: Reference Parameters are used to pass parameters into methods by reference.
Parameter Arrays: Parameter Arrays are used in a method definition to enable it to receive a variable number of arguments when called.