Hey guys,
Who would have thought that I would post a question to the user forum eh?
My question is: What's the deal with non-nullable "primitive"
types in C# ? Like seriously, Int32 extends Object (via struct?),
and it's a class......so why can't it be set to null?
Whoops, that's a question for Microsoft. :-)
Anyway, a better question for this list is: What pattern do you
use to represent NULL types from the database. That is, say you
have an NUMERIC NULL field, and you want to map it to a class with a
field/property of type int (Int32). It won't work because int
can't represent null. So ...
Do you?
A) Write your own "NullableInt32" class and use a more complex mapping?
B) Use null value replacement and set the primitive to a magic number?
C) Something else?
Thanks much!
Clinton
- Dealing with non-nullable C# "primitives" Clinton Begin
- Re: Dealing with non-nullable C# "primitives&q... Gilles Bayon
- Re: Dealing with non-nullable C# "primitives&q... Jaroslaw Kowalski

