Home > Net >  About the Nullable type on the deep understanding of c # Nullable a description of what it mean?
About the Nullable type on the deep understanding of c # Nullable a description of what it mean?

Time:11-14



The realization of the c # about Nullable is not a sign with a (flag bit)? The author here feel denial? Isn't Nullable with flags? We want it to have a real value of the bit pattern of the complete what meaning be?

CodePudding user response:

The Nullable value types and reference so that it can be left blank,

CodePudding user response:

reference 1st floor icoolno1 response:
Nullable value types reference, so that it can be left blank,

Nullable Is the structure, value types,

CodePudding user response:

If Int32 directly add the sign bit is, of course, in this way, value types (primitive types) is a c # can't be empty and such implementation, Nullable is wrapped in primitive types such as Int32 struct, increased memory most is to write their own business account for a little more, the last point means 32767 to - 32768 should represent the number itself, rather than ancient times that get Int32. Minvalue (typically) to represent a null value (of course also have to make it into a class) database field, for example, the above is purely personal opinion,

CodePudding user response:

refer to the second floor lianying168000 response:
Quote: refer to 1st floor icoolno1 response:
Nullable value types reference, so that it can be left blank,

Nullable Structure, value types,


If the Nullable As Nullable , isn't it easier to understand?

Look at the ValueType definition:
Public abstract class ValueType: Object

Here are simply using Nullable The implicit packing unboxing operations,
  •  Tags:  
  • C#
  • Related