Methods are reusable units of work in a self contained code-block. In C-Sharp every statement is executed within a method. Methods are blocks of code that carry out a single, pre-defined function. They can be defined inside of Classes, structures and interfaces.
Access Modifiers controls access to methods. ^[Defaults to private if not defined.]
=>Arrow functions should not be used for methods.
- Methods should end with arguments
- Methods should be named in PaschalCase.
Calling a Method
Calling the method WriteLine inside of the class Console:
Console.WriteLine("Hello World"); // Class.Method("Statement")
- Access Modifiers
voidnothing is returned, we’re just executing code inside the Methods
- Handling strings in C-Sharp
- String Methods:
- Structuring Your Code