I have a public property with a null value for a class using Vb.net 3.5:
Public Property TicketCharge() As Nullable(Of Decimal)
Get
If _TicketCharge = Nothing Then
Return Nothing
Else
Return _TicketCharge
End If
End Get
Set(ByVal value As Nullable(Of Decimal))
If value.HasValue Then _TicketCharge = value
End Set
End Property
There is a method that assigns a value. It works fine, except when I try to set it to 0 (zero).
If FundBuySell = "Exchange $" Or FundBuySell = "Exchange Shares" Then
TicketCharge = 0
Else
When I assign zero and then retrieve it, it shows property = nothing.
I need the property to sometimes be Null and Zero. Can someone explain what is happening?
source
share