It seems like overkill to set the value of a nullable type and implement iNotifyPropertyChanged. Is there a better way of doing this?
Private _WorkPhone As Long?
Public Property [WorkPhone]() As Long?
Get
Return _WorkPhone
End Get
Set(ByVal value As Long?)
If value.HasValue = False Then
If _WorkPhone.HasValue = True Then
MyBase.RaisePropertyChanging("WorkPhone")
_WorkPhone = Nothing
MyBase.MarkDirty()
MyBase.RaisePropertyChanged("WorkPhone")
End If
Else
If _WorkPhone.HasValue Then
If _WorkPhone.Value <> value.Value Then
MyBase.RaisePropertyChanging("WorkPhone")
_WorkPhone = value
MyBase.MarkDirty()
MyBase.RaisePropertyChanged("WorkPhone")
End If
Else
MyBase.RaisePropertyChanging("WorkPhone")
_WorkPhone = value
MyBase.MarkDirty()
End If
MyBase.RaisePropertyChanged("WorkPhone")
End If
End Set
End Property
I tried using simple code, but my breakpoint on MyBase.RaisePropertyChanging("WorkPhone") is never hit, and the value never changes.
If _WorkPhone <> value Then
MyBase.RaisePropertyChanging("WorkPhone")
_WorkPhone = value
MyBase.MarkDirty()
MyBase.RaisePropertyChanged("WorkPhone")
End If