CSharp – Functions
A function allows you to encapsulate a piece of code and call it from other parts of your code.
Syntax:
<visibility> <return type> <method name>(<parameters>) { <function code> }
Example:
... public int AddNumbers(int number1, int number2) { int result = number1 + number2; return result; } ... int result = AddNumbers(10, 5); Console.WriteLine(result); ...