C # variable types
-
Value delivery type
- Integer types: sbyte byte int uint short ushort long ulong char
- Floating point: float double
- Decimal: decimal
- Boolean
- Empty type
- Conver carrying values are converted to value type
- Other types of values may be defined eg enum class
-
constant
- The value of the constant can not be modified after being defined
- Constant type
- Integer constant
- Floating-point constants
- Character constant
- It can be an ordinary character or escape character 'x', single quotes
- String constant
- Define constants
- Use const keyword to define
-
Operators
- Arithmetic operators
- +, -, *, /, ++, -- , %
- Relational Operators
- ==, !=, > , <, >= , <=
- Logical Operators
- &&, ||, !
- Bitwise Operators
- Assignment Operators
- = , += , /=, *= , ^= , % =, -= , >>= , <<= , &= , |=
- Other Operators
- the sizeof () returns the size of the data type
- typeof () Returns the type calss
- & Return address of a variable
- ? : Conditional expression
- If it is determined whether a type is eg if (Ford is Car) is an object inspection Ford Car class
- cast as a failure even though the transition exception is thrown Object obj = new StringReader ( "Hello"); StringRead r = obj as StringReader;
- Arithmetic operators
-
Operator Precedence
- Consistent with the C ++ (C ++ I am the ape)