ThatRickGuy
Programmer
Hey guys, I'm having a brain fart this afternoon.
I have a method that takes a parameter byRef. I need to use that variable, and modify it, and I want to sender to see the same changes. The problem is I need to use the variable out side of the scope of that specific method.
here's a short version:
The bolded line is, as expected copying the value that MyVar contained when it was passed in. But I want _MyVar to point at the same object in memory. And for the life of me, I can't remember how.
-Rick
VB.Net Forum forum796 forum855 ASP.NET Forum
I believe in killer coding ninja monkeys.![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
I have a method that takes a parameter byRef. I need to use that variable, and modify it, and I want to sender to see the same changes. The problem is I need to use the variable out side of the scope of that specific method.
here's a short version:
Code:
class MyClass
private _MyVar as string
public sub New(byRef MyVar as string)
[b]_MyVar = MyVar[/b]
end sub
Public sub SomethingElse()
_MyVar &= "SomethingElse"
End sub
end class
The bolded line is, as expected copying the value that MyVar contained when it was passed in. But I want _MyVar to point at the same object in memory. And for the life of me, I can't remember how.
-Rick
VB.Net Forum forum796 forum855 ASP.NET Forum
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)