ByRef vs ByVal generates errors!?
- by serhio
ByRef vs ByVal generates errors!?
I had a method that used an Object
Function Foo(ByRef bar as CustomObject) as Boolean
this method generated errors, because some strange .NET Runtime things changed the bar object, causing its Dispose()al.
A lot of time spent to understand the thing(where the ... object is changed), until somebody replaced ByRef by ByVal and object wasn't change anymore when passing to this method...
Somebody could explain this, what happens?