[C #] implementation principle of the void type,
Int? Is a null value type. Only one value greater than int Is null.
Thoughts:
In the same memory space, how can one more value be implemented? All are 4 bytes, 32 bits, int? Depends on what has a null value.
Found:
Analyze the memory to see how it is implemented.
When int I = max; int? J = max; the value of the next 4-byte address of j is the same as that of I.
Assign a null value to j. The original value of 1 is 0.
Assign a value of 0 to j. The original value of 0 is 1. j, 1. j, or 1. j, respectively.
Result:
Determine int? Originally 8 bytes. When the first 4 bytes are 1, it is not null. The last four bytes are exactly the same as the normal int type.
Int? Bool? This can be empty typeMeaning?
1. to match the corresponding types in the database.
2. Some controls have three states. Such as: checkbox, selected, unselected, not all selected