Forum Discussion

ak's avatar
ak
Occasional Contributor
13 years ago

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

1 Reply

  • joffre's avatar
    joffre
    Regular Contributor


    Have you tried to debug your code?



    What is that object 'ap' that calls the GetObject method? Are you instantiating it somewhere?



    Att.,

    Joffre Mota