
|  | Try (For modes 2D, 3D, Console) |  Show exampleHide example | We put into to block try those commands that could raise an exception in program runtime. | |
|
|  | Catch (For modes 2D, 3D, Console) |  Show exampleHide example | In the catch block we can process exception raised in the try block. | |
|
|  | Finally (For modes 2D, 3D, Console) |  Show exampleHide example | Block finally is executed every time, even if there was an exception in the try block, and even if the exception was not processed in the catch block. | |
|
|  | Throw (For modes 2D, 3D, Console) |  Show exampleHide example | Gives programmer the ability to raise an exception. | |
|
|  | Keyword 'using' (For modes 2D, 3D, Console) |  Show exampleHide example | This keyword determines the scope of parameter activity. | |
|
|  | Keyword 'lock' (For modes 2D, 3D, Console) |  Show exampleHide example | This keyword marks block as critical and gains exclusive rights to access given object. |
Po provedení bloku príkazu je uzamcení objektu opet uvolneno.
Syntaxe:lock(výraz)príkaz
Creates new object o. Then marks it as critical, writes to the text string its type and clear it down. | | |
|
|
|  | Checked (For modes 2D, 3D, Console) |  Show exampleHide example | Enables checking overflow in aritmetic operations. | Creates new char variable c, in which adds number 0 converted to char. Then writes to the output window value of variable a. Takes number 1 from variable c and again tries to writes value of varialbe c, but variable c causes overflow. | | |
|
|
|  | Unchecked (For modes 2D, 3D, Console) |  Show exampleHide example | Disables ckecking overflow in aritmetic operations for. | |
|
C# statements can execute in either checked or unchecked context. In a checked context, arithmetic overflow raises an exception.
In an unchecked context, arithmetic overflow is ignored and the result is truncated.
In a checked context, if an expression produces a value that is outside the range of the destination type, the result depends on whether the expression is constant or non-constant.
Constant expressions (expression with constants and literals only) cause compile time errors, while non-constant expressions (expressions with variables) are evaluated at run time and raise exceptions.
|  | Keyword 'as' (For modes 2D, 3D, Console) |  Show exampleHide example | Performs conversion to a different type (safe type cast) | |
|
|  | Keyword Is (For modes 2D, 3D, Console) |  Show exampleHide example | Determines whether the type of an expression is the same as given type. Returns true when types are the same. | |
|
Did you find this information useful?
Documentation of SGP Baltie 4 C#
Send us comments on this topic by
this form
©1978-2010
SGP SystemsParent page |
Previous page |
Next page