问候,
我只是有一段时间的程序员,我对基础有一些疑问,请您澄清以下内容:案例1:
Public Class BillItems
Implements INotifyPropertyChanged
Public Event PropertyChanged As PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Private Sub NotifyPropertyChanged(ByVal info As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
End Sub
Private _BillIdValue As String
Property BillId As String
Get
Return _BillIdValue
End Get
Set(ByVal value As String)
If Not _BillIdValue = value Then
_BillIdValue = value
End If
End Set
End Property
End Class
案例二:
Public Class BillItems
Implements INotifyPropertyChanged
Public Event PropertyChanged As PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Private Sub NotifyPropertyChanged(ByVal info As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
End Sub
Property BillId As String
Get
Return BillId
End Get
Set(ByVal value As String)
If Not BillId = value Then
BillId = value
End If
End Set
End Property
End Case
案例 1 和案例 2 是否产生相同的结果,我的意思是那里必须有一个私有值?我们可以使用属性本身在其 Set 和 get 语句中使用它自己的值吗?
谢谢你。