I use a webbrowser control to call a javascript function in a html file using InvokeScript(). I would like to pass four lists as parameters so I can use the data in the javascript function.
pseudocode:
List<string> list1 = new List<string>();
list1.Add("foo");
list1.Add("bar");
List<string> list2 = new List<string>();
list2.Add("foo");
list2.Add("bar");
List<string> list3 = new List<string>();
list3.Add("foo");
list3.Add("bar");
List<string> list4 = new List<string>();
list4.Add("foo");
list4.Add("bar");
maps_webbrowser.Document.InvokeScript("initialize", list1.ToArray(), list2.ToArray() ,list3.ToArray() ,list4.ToArray());
I have read a post where a list is passed using a argument variable
How should an array be passed to a Javascript function from C#?
Here's an example JavaScript function:
function foo()
{
var stringArgs = [];
for (var i = 0; i < arguments.length; i++)
stringArgs.push(arguments[i]);
// do stuff with stringArgs
}
And you'd call it from C# like this:
List<string> arguments = new List<string>();
arguments.Add("foo");
arguments.Add("bar");
webBrowser.InvokeScript("foo", arguments.ToArray());
However, in this way only one list is passed.
The pseudocode I've wrote down does not work....