Dear all, I wonder what is the type of null
literal in C#?
In Java, the null
literal is of the special null type:
There is also a special null type, the type of the expression null
, which has no name. Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type. The null reference is the only possible value of an expression of null type. The null reference can always be cast to any reference type.
In C++11, there is nullptr
(the recommended version of the old buddy NULL
), which is of type std::nullptr_t
.
I searched MSDN about C#, but the specification doesn't seem to say anything about that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…