Okay, I know what byVal and byRef do, ByVal passes a copy of an object, and ByRef passes the actual object, but lets say I have this code:
Will the object mTest's handler be unassigned correctly? Or since i've passed a copy of the object, the original will still fire again? Should I just stick to writing everything byref instead? My application seems to eat up alot of memory, because something is getting stuck and not used. It uses a similar structure to the code above. Any tips?
Any help would be appreciated. Thanks.
Visual Basic:
Class myTest
Event myEvent(ByVal sender as myTest)
sub FireEvent()
RaiseEvent myEvent(me)
end sub
End Class
sub RunTest()
dim mTest as new myTest
addhandler mTest.myEvent, addressof del_myEvent
mTest.FireEvent
end sub
sub del_myEvent(byval sender as myTest)
RemoveHandler sender.myEvent,addressof del_myevent
end sub
Will the object mTest's handler be unassigned correctly? Or since i've passed a copy of the object, the original will still fire again? Should I just stick to writing everything byref instead? My application seems to eat up alot of memory, because something is getting stuck and not used. It uses a similar structure to the code above. Any tips?
Any help would be appreciated. Thanks.