vendredi 20 mars 2015

Calling method with "out" parameter from dynamically loaded dll? [duplicate]


I'm using reflection to load my dll. I can call its methods, get its parameters, etc. But can't figure out how to call a method that has an out parameter. Here's an example of a method I'm trying to call


Dll out method



public void GetNumber(out int number)
{
......
number = 5;
}


I tried with the following, but number value is not changing.



int number = 0;
myType.InvokeMember("GetNumber", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, myInstance, new object[] { number });


How can I achive this?






Aucun commentaire:

Enregistrer un commentaire