Branch statement
- Value Method when the value may be null
If (){} Else if (){} Else {} |
switch (VAR) { case :...... Break; default :...... Break; } |
Iteration statement
Do {......} While (<Test> ); |
For (<initialization >;< condition >;< operation>) {......} |
Foreach (<basetype> <Name> in <array>) {......} |
jump statement
Terminate cycle now
End the current cycle and enter the next cycle
Jump out of loop to mark position
Goto <labelname>; <Labelname>: |
jump out of the loop and end the method containing it
exception BLOCK statement
The throw statement is used to issueProgramAbnormal (abnormal) signal during execution.
A try-catch statement consists of a try block followed by one or more catch clauses. These clauses specify different exception handlers, specify catch {...} for general exception handling {......}.
the Finally block is used to clear any resources allocated in the try block, and run any Code that must be executed even when an exception occurs. The control is always passed to the Finally block, regardless of the exit mode of the try block.
A common method used by catch and finally is to obtain and use resources in the try block, handle exceptions in the Catch Block, and release resources in the Finally block.
overflow check statement
Test whether the value type overflows during arithmetic operations. If the overflow occurs, the system. overflowexception exception is obtained.
Try { Checked {......} } Catch (overflowexception ex) { ...... } |
Disable the detection of some codes and ignore overflow exceptions in arithmetic operations