CSharp - Method Method Creation

Introduction

A method performs an action.

A method can receive data from the caller via parameters and transfer data back to the caller via a return type.

A method can specify a void return type, indicating that it doesn't return any value to its caller.

A method can also output data back to the caller via ref/out parameters.

A method's signature must be unique within the type.

A method's signature is its name plus parameter types in order.

Neither the parameter names nor return type are part of the method signature.

Methods allow the following modifiers:

Item Value
Static modifier static
Access modifiers public internal private protected
Inheritance modifiers new virtual abstract override sealed
Partial method modifierpartial
Unmanaged code modifiersunsafe extern
Asynchronous code modifier async

Example