1. Overview
This chapter includes Boolean expressions, flow control methods, collection traversal, and flow jumps.
2. Main content
* As the content of the chapter is relatively basic, the daily use of a lot, so the basic content of some commonly used not to repeat.
2.1 Using Boolean expressions
Familiar with the following comparison operators: <, >=, <=, = =,! =.
Be familiar with the following logical expressions: &&, | |, ^.
BOOL true ; BOOL false //False//true//false
2.2 Program Flow control
C # provides flow control modes: If, while, does while, for, foreach, switch, break, continue, Goto,?? (Null-coalesce op),?:( Conditional op).
int NULL ; int NULL ; int z = x?? Y?? -1; The value of Z is-1
2.3 Integrated Traversal
You can use for, foreach, while, and do and four ways to traverse.
foreach inch people) { "Changed"//OK New // Compile Error}
The reason for the above code compilation error is the way that foreach is implemented:
New people. GetEnumerator (); Try {person v; while (E.movenext ()) = e.current;} finally { as system.idisposable; if NULL ) d.dispose ();}
Chapter III Implementation flow of the management program flow (in. net4.5)