C
C. Herzog
Hi!
I want to create a huge amount of classes. All classes have in common
that the change of a property should fire an Change-Event and maybe do
other things. I don't want to write thousand times the same things
like that:
Public Property Price() As Double
Get
Return _Price
End Get
Set(ByVal value As Double)
If Not _Price = value Then
Dim old As Object = _Price
_Price = value
RaiseEvent PropertyChanged(Me, New PropertyEventArgs("Price",
old, value))
End If
End Set
End Property
Writing this in every class (and every Property) makes no clear code.
Any Ideas?
My Idea was to use the reflection and observe the properties, but I
dont know how to do that.
Thanks for every comment.
C. Herzog
I want to create a huge amount of classes. All classes have in common
that the change of a property should fire an Change-Event and maybe do
other things. I don't want to write thousand times the same things
like that:
Public Property Price() As Double
Get
Return _Price
End Get
Set(ByVal value As Double)
If Not _Price = value Then
Dim old As Object = _Price
_Price = value
RaiseEvent PropertyChanged(Me, New PropertyEventArgs("Price",
old, value))
End If
End Set
End Property
Writing this in every class (and every Property) makes no clear code.
Any Ideas?
My Idea was to use the reflection and observe the properties, but I
dont know how to do that.
Thanks for every comment.
C. Herzog