G
giant food
since I can't specify an integer to be null (i.e. undefined), I'd like
to create a structure that provides the same functionality, like:
Public Structure NullableInt
Private i As Integer
Private bHasValue As Boolean 'false if null
End Structure
so that works okay, but I'd like users to be able to use integers in
places where a NullableInt is called for. For example, suppose there
is a function SaveValue(x as NullableInt). I'd like to allow this sort
of call:
SaveValue(7)
Is there a function I can get to write to get .NET to cast the 7 into
a NullableInt? And if I wrote the following:
SaveValue(System.DBNull.Value)
....I'd like that to convert to NullableInt as well. Is this possible
in .NET?
Is there a better method (or already-existing datatype) that I'm
missing?
Thanks!
-Frank
to create a structure that provides the same functionality, like:
Public Structure NullableInt
Private i As Integer
Private bHasValue As Boolean 'false if null
End Structure
so that works okay, but I'd like users to be able to use integers in
places where a NullableInt is called for. For example, suppose there
is a function SaveValue(x as NullableInt). I'd like to allow this sort
of call:
SaveValue(7)
Is there a function I can get to write to get .NET to cast the 7 into
a NullableInt? And if I wrote the following:
SaveValue(System.DBNull.Value)
....I'd like that to convert to NullableInt as well. Is this possible
in .NET?
Is there a better method (or already-existing datatype) that I'm
missing?
Thanks!
-Frank