I tend to use
If Not IsDBNull(dr("data")) Then
myData = dr("data")
End If
to catch nulls. Is there a better way? It seems I use this over and over again? Anyone write a function to check this something like
mydata = IfNotNull("data")
I don’t know how to handle the different data types that could be returned.
Thanks for any thoughts!
In cases where my CLR object is Nullable, back when I was using VB.NET I used this extension method:
With the following delegate for
Conversion(Of T):I then layer on extensions for relevant datatypes:
Finally, I can use: