Chapter 9. Parameters

In this chapter:

Optional and Named Arguments

Implicitly Typed Local Variables

Passing Parameters by Reference to a Method

Passing a Variable Number of Arguments to a Method

Parameter and Return Type Guidelines

Const-ness

This chapter focuses on the various ways of passing parameters to a method, including how to optionally specify parameters, specify parameters by name, and pass parameters by reference, as well as how to define methods that accept a variable number of arguments.

Optional and Named Arguments

When designing a method’s parameters, you can assign default values to some of or all the parameters. Then, code that calls these methods can optionally not specify some of the arguments, thereby accepting the default values. ...

Get CLR via C#, Fourth Edition 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.