This is the official page of the method and I need to use an 'out' parameter as an argument, I guess. I have a method like this:
bool GetInfo(out List<foo> bar);
How can I use an out parameter without changing the method that I invoke? I really don't want to return a Set of bool and List in this case.
So far, I have tried to use it like this:
EndInvoke("GetInfo", new object[] { out bar }, ...);
EndInvoke("GetInfo", new object[] { bar }, ...);
EndInvoke("GetInfo", new object[] { }, ...);
EndInvoke("GetInfo", null, ...);
List<foo> bar = (List<foo>)EndInvoke("GetInfo", new object[] { bar }, ...);
but nothing really makes sense and the out bar inside the object array obviously doesn't work at all.
Apparently you just ignore the out parameter. This is my current working solution:
public bool GetInfo(out List<foo> bar) {
bar = new List<foo>();
object[] args = new object[] { bar };
IAsyncResult result = BeginInvoke("GetInfo", args, null, null);
EndInvoke("GetInfo", args, result);
bar = (List<foo>)args[0];
return true;
}
And the Invokes call uses the GetInfo method from the interface line given in the question. They are 2 separate methods using the same name, so if anyone sees this and thinks it could help them, don't get confused by it.