mardi 14 octobre 2014

COM-interop class instance and optional parameters


Vote count:

0




I have an instance of a COM-interop class that has a method with a signature like



bool InteropClass.Method(params object[] Values)


And I thought I could call it like



interopClassInstance.Method("something", "something else", "something else");


But when I try to do it like that the compiler complains that No overload for method 'Method' takes 3 arguments. So, the only way I found that makes it work is to call it like



interopClassInstance.Method(new object[] {"something", "something else", "something else"});


Is this the correct way to do it? Isn't the params keyword supposed to enable the passing of n parameters?



asked 51 secs ago

ferc

120






COM-interop class instance and optional parameters

Aucun commentaire:

Enregistrer un commentaire