A long title, but I wanted it to be specific. The title is really the question. Even though the method that InvokeMember
is calling has an out
pa
In your first code example, the call to InvokeMember
doesn't modify the value of the parameter
variable, it just replaces the first item in the parameter array (which now points to a different string
instance). Since you didn't keep a reference to this array, you can't retrieve the value of the output parameter.
In other words: the array initially contains a copy of the parameter
variable (i.e. a copy of the reference to an empty string). After the call, parameter
and the value in the array refer to 2 different string instances.