ByRef vs ByVal generates errors!?

Posted by serhio on Stack Overflow See other posts from Stack Overflow or by serhio
Published on 2010-04-26T14:10:39Z Indexed on 2010/04/26 14:13 UTC
Read the original article Hit count: 279

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net