ak
13 years agoOccasional Contributor
How to pass an argument defined as params (in C#) with Jscript?
Hi,
I need help of calling a methode (in the api of the application) which defined its argument as params. For example
API:
public object GetObject(params object[ ] list)
in TestComplete
var plan; //this is an object get through another function
var arrObj = new Array(3);
arrObj[0] = "string 1"
arrObj[1] = "string 2"
arrObj[2] = plan
var obj = ap.GetObject(arrObj);
And I got an error which say System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to calss type 'System.Reflection.MemeberInfo'.
I don't know what I did wrong. Can someone show me how to define a params arguments to call that function?
Thank you so much
I need help of calling a methode (in the api of the application) which defined its argument as params. For example
API:
public object GetObject(params object[ ] list)
in TestComplete
var plan; //this is an object get through another function
var arrObj = new Array(3);
arrObj[0] = "string 1"
arrObj[1] = "string 2"
arrObj[2] = plan
var obj = ap.GetObject(arrObj);
And I got an error which say System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to calss type 'System.Reflection.MemeberInfo'.
I don't know what I did wrong. Can someone show me how to define a params arguments to call that function?
Thank you so much