Learn C # (value type)
C # Talent Bird (QQ: 249178521)
1.
Type bit system. Compatible with CLS? Is there a symbol SBYTE 8 Sbyte No USHORT 16 uint16 No uint 32 uint32 No ulong 64 uint64 No
Byte 8 Byte is no Short 16 INT16 is INT 32 INT32 is long 64 int64
There are symbolic shaping and byte types belonging to the General Language Authentication System (CLS). And no symbol shaping is not a CLS.
You can use the original type keyword (such as int) or the alias (such as system.int32), both of which are feasible. But the only exception is: When you use the type name as a .NET Framework function, you can only use System.Int32 without using INT. For example, you have to call: type.gettype ("System.Int32"), and the Type.getType ("int") statement is incorrect. This is because INT is just a keyword in C #, and the .NET Framework function is designed in all .NET languages. It must be noted that Byte is unsigned in C #.
Note: Byte and Sbyt are only 8 bits, so they cannot be used as an array element because the minimum size of array elements is 16 bits (2 bytes).
2. Basic operator
Brand (X) Access Member XY Function Call f (x) Access arrays (not element) A [x] Self-add X self-reduction X-call constructor New Get class name TypeOf Get Size SizeOf (unsafe) value check (unsafe) numerical check ( UN) checked
The basic operator has the highest priority.
New can only be used when the constructor is called and cannot be used to overload. Using New to call the structure constructor allocate memory in the stack (STACK), and use New to call the class constructor to allocate memory in the heap (HEAP). In C #, the structure is a value type, and the class is a reference type.
SIZEOF returns the size of the class or an expression, but it can only be used in the code block identified as unsafe.
Checked and unchecked operators Control whether to check the arithmetic operation overflow.
3. Priority level of operator
Basic operations see the first table 1 yuan operator -! ~ x - x (t) x multiply and divide * /% (more) and reduce - shift << >> relationship <> <=> = IS AS equal ==! = bit operation & ^ | (Note: Left is higher than right edge) Boolean && ||?: (Note: Left to the right level high) assignment = * = / =% = = - =. .
All one-dollar operators can be overloaded.
Multiply, addition, addition, shift, relationship (IS AS exception), equal and bit operations can be overloaded.
&& and || Can only be overloaded when using True / False to convert operators.
?: Hey = cannot be overloaded.
The composite assignment operator (such as * = / =) can be overloaded.