[2.0] Invoking methods with ref parameters
I'm trying to call a method that takes a parameter by ref.
The code below doesn't work. The variable 's' doesn't change after the method is called. I've stepped through the method that's called by the invoke and s definately changes within the method, but once it returns s is uneffected.
Code:
ParsedText =
(string)Type.GetType(ClassName).GetMethod(
ClassMethod,
new Type[] { typeof(string).MakeByRefType() }).Invoke(null, new object[] { s });
Cheers for any help!
Re: [2.0] Invoking methods with ref parameters
I used this to pass a value by reference:
Method:
public void SomeMethod(ref int x)
{
..... change value x in here
}//
Some other class:
int x
.......
SomeMethod(ref x);
// at this point, the changes that SomeMethod made with x is now persistent.