Will [WithEvents = Nothing] RemoveHandlers in the derived class?
- by serhio
I use to set WithEvents variables to Nothing in Destuctor, because this will "Remove" all the Handlers associated with Handles keyword. Will this have the same effect for derivated classes?
Class A
    Protected WithEvents _Foo as Button
    Private Sub _Foo_Click Handles _Foo.Click
        ' ... some Click action '
    End Sub
    Public Sub Dispose(disposing as Boolean)
        If disposing then _Foo = Nothing ' remove handler _Foo_Click '
    End Sub
End Class
Class B
    Inherits A
    Private Sub _Foo_Move Handles _Foo.Move
        ' ... some Move action '
    End Sub
    ' ????? will or NOT remove OR handler _Foo_Move the base Dispose??'
    Public Overrides Sub Dispose(disposing as Boolean)           
        'If disposing then _Foo = Nothing '
        MyBase.Dispose(disposing)
    End Sub
End Class