CONTENTS
Restrictions on Implicitly Typed Variables............................................................................................ 109
Implicit Typed Data Is Strongly Typed Data.......................................................................................... 110
Usefulness of Implicitly Typed Local Variables..................................................................................... 111
C# Iteration Constructs ..................................................................................................112
The for Loop.......................................................................................................................................... 112
The foreach Loop.................................................................................................................................. 113
The while and do/while Looping Constructs ........................................................................................ 114
Decision Constructs and the Relational/Equality Operators ..........................................114
The if/else Statement ........................................................................................................................... 115
Equality and Relational Operators ........................................................................................................ 115
Conditional Operators ........................................................................................................................... 116
The switch Statement........................................................................................................................... 116
Summary .......................................................................................................................118
Chapter 4: Core C# Programming Constructs, Part II .........................................121
Methods and Parameter Modifiers ................................................................................121
The Default by Value Parameter-Passing Behavior .............................................................................. 122
The out Modifier ................................................................................................................................... 123
The ref Modifier .................................................................................................................................... 125
The params Modifier ............................................................................................................................ 126
Defining Optional Parameters............................................................................................................... 127
Invoking Methods Using Named Parameters ....................................................................................... 129
Understanding Method Overloading ..................................................................................................... 130
Understanding C# Arrays ...............................................................................................133
C# Array Initialization Syntax................................................................................................................ 134
Implicitly Typed Local Arrays................................................................................................................ 134
Defining an Array of Objects................................................................................................................. 135
Working with Multidimensional Arrays................................................................................................. 136
Arrays As Arguments or Return Values ................................................................................................ 137
x