On 29.10.2011 04:04, Steven Schveighoffer wrote:

I don't like Variant having this behavior when it's only of specific
use.  Variant is not a database-only type.

Here's another idea:

struct DBNull(T) { }

Where T is the type for the column.  i.e.:

row.column = DBNull!int;

Now, you have your flag indicating it's null (you should be able to
write a function that returns whether the column is null or not), it
doesn't consume any more space (value is already part of a union that's
bigger than DBNull!int), and the type of field is still valid.

This is basically what ADO.Net does: http://msdn.microsoft.com/en-us/library/system.dbnull.aspx

Reply via email to