Upload
tuan-ngo
View
572
Download
1
Embed Size (px)
Citation preview
Types of Statements
Selection
| if, else, switch, case
Iteration
| for, foreach, while
Jump
| break, continue, default, goto, return, yield
Exception Handling
| throw, try-catch, try-finally, try-catch-finally
Checked and Unchecked
Fixed
| fixed, unsafe
Lock
Types of Operators
Types of Operators
Arithmetic
Relational
Logical
Conditional
Increment and Decrement
Assignment
Arithmetic Operators
are binary operators.
Relational Operators
Logical Operators Boolean Logical Operators
Bitwise Logical Operators
Bitwise Logical Operators Boolean Logical Operators
http://pastebin.com/BuXr5Zxq
AND
Conditional Operators
AND (&&) evaluates the second expression only if the first one return true. https://gist.github.com/2318365
OR (||) evaluates the second expression only if the first one return false. https://gist.github.com/2318398
Increment and Decrement Operators
Assignment Operators
Precedence and Associativity
Data Conversions
Typecasting
Implicit typecasting (Coercion) refers to an automatic conversion of data type
done when the destination data types belong to the same hierarchy and the destination data type must hold a larger range of values than the source data type
https://gist.github.com/2318445
Implicit typecasting (Coercion)
Explicit typecasting refers to changing a data type of higher precision into a data type of lower precision.
the destination data type hold a smaller range of values than the source data type
<tager data type> <variable name> = (target data type) <source data type>;
https://gist.github.com/2318452
Explicit typecasting using built-in method System.Convert class
Convert.ToChar(float)
ToString() method
https://gist.github.com/2318468
Boxing converting a value type to its reference type.
Unboxing converting a reference type to a value type
Boxing & Unboxing https://gist.github.com/2318516
Question?
What is the result of the following code snippets?
https://gist.github.com/2318553
Question?
What is the result of the following code snippets?
https://gist.github.com/2318553