Look at these 3 bars, found that the author is too detailed, put a normal use of the usage is too god-dense, do not know that they do not understand the author's painstaking, or the author's intention, here to everyone is simple to say, too deep sincerity can not go on.
1. The core part of the nullable type is System.nullable<t>, which, in addition to this, has a tool method provided by the static class System.Nullable.
2.nullable<t> is a generic type, and the type parameter T is a value type constraint.
The type of 3.T is called the underlying type of a nullable type.
4.nullable<t> has two constructors, one for creating an instance with no value, one for receiving an instance of T as a value
1 nullable<intnew nullable<int>(); 2 nullable<intnew nullable<int> (1);
5. The framework provides two transformations, and the implicit conversion of T to nullable<t>,nullable<t> can be explicitly converted to T
1 nullable<long7; 2 Long L = (long) NL; 3 4 // error, requires explicit conversion 5 // long ll = NL;
Speaking of the first line of code, let me think of C + + in the Copy construction method, or a parameter of the construction method, you can go to see, C # should also be implemented in C + +.
6.nullable<t> Boxing and unpacking, do not know whether it is possible to understand the implicit conversion of T to nullable<t> is boxed,nullable<t> can be explicitly converted to T is unboxing.
7. You can use the syntax sugar, reduce the input of the code, use a symbol "?"
1 int null;
8. You can use NULL for comparison, as above
9. Nullable types can participate in operators, which include some type conversions, which are used to discover the same type as normal, and because nullable types can use null representations, they can participate in logical operators (that is, return true and false ones). It is also possible to think of the operator as as normal and usable.
Please treatise.
Reference page:hTTP://QINgQINgQuege.CNbLogs.Com/P/5933752.hTmL
08.c# system.nulable<t> and null reference operators (four chapters 4.2-4.4)