Is there any difference between type? and Nullable?

前端 未结 9 1135
礼貌的吻别
礼貌的吻别 2020-12-15 15:53

In C# are the nullable primitive types (i.e. bool?) just aliases for their corresponding Nullable type or is there a difference between th

9条回答
  •  囚心锁ツ
    2020-12-15 16:26

    A Nullable is a structure consisting of a T and a bit flag indicating whether or not the T is valid. A Nullable has three possible values: true, false and null.

    Edit: Ah, I missed the fact that the question mark after "bool" was actually part of the type name and not an indicator that you were asking a question :). The answer to your question, then, is "yes, the C# bool? is just an alias for Nullable".

提交回复
热议问题