0

Why using the following syntax the if operator does not return an empty decimal as expected ?

    Dim d As Decimal?
    d = If(false, 10, Nothing)

    Console.WriteLine("d.HasValue: " + d.HasValue().ToString())

Working workaround follows:

    Dim d As Decimal?
    Dim NullDecimal As Decimal?
    d = If(false, 10, NullDecimal)
frhack
  • 4,862
  • 2
  • 28
  • 25

0 Answers0