VB2005 Tips and Tricks – part 7

Make Simple Data Types Nullable

 

dim i as Nullable(Of Integer)
If not i.HasValue then
 Console.WriteLine("i is a null value")
End If

i=100
If i.HasValue then
 Console.WriteLine("Nullable integer i = " & i.Value)
End If

Comments are closed.