Sunday 15 May 2011

c# - COM-interop class instance and optional parameters -



c# - COM-interop class instance and optional parameters -

i have instance of com-interop class generated vs result of referencing activex dll. 1 of methods of interop class has signature like

bool interopclass.method(params object[] values)

where 'original' method (vb6 code) has signature like

method(paramarray values() variant) boolean

and thought phone call c#

interopclassinstance.method("something", "something else", "something else");

but when seek compiler complains no overload method 'method' takes 3 arguments. so, way found makes work phone call like

interopclassinstance.method(new object[] {"something", "something else", "something else"});

is right way it? isn't params keyword supposed enable passing of n parameters?

c# com-interop optional-parameters

No comments:

Post a Comment