C H A P T E R 5
Methods
- The Structure of a Method
- Code Execution in the Method Body
- Local Variables
- Local Constants
- Flow of Control
- Method Invocations
- Return Values
- The Return Statement and Void Methods
- Parameters
- Value Parameters
- Reference Parameters
- Reference Types As Value and Reference Parameters
- Output Parameters
- Parameter Arrays
- Summary of Parameter Types
- Method Overloading
- Named Parameters
- Optional Parameters
- Stack Frames
- Recursion
The Structure of a Method
A method is a block of code with a name. You can execute the code from somewhere else in the program by using the method's name. You can also pass data into a method and receive data back as output.
As you saw in the previous chapter, a method is a function member of a class. ...
Get Illustrated C# 2012 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.