Is there a more streamlined method for converting a two-dimensional array in C# like [[1, 2, 3],[4, 5, 6]] into a string representation "[[1, 2, 3],[4, 5, 6]]" without manually iterating through each value and formatting it?
I want to pass the array as an argument in my webView.ExecuteJavascript() function, which requires the method name string. Ideally, in C#, it would appear as:
webView.ExecuteJavascript("updateValues([[1, 2, 3],[4, 5, 6]])")
The updateValues function in JavaScript is defined as:
updateValues(newvalues) {
oldvalues = newvalues
}
Is there a more efficient way to achieve this task? Currently, the results are stored in a list of double arrays (List), and calling .ToArray().ToString(), like so:
webView.ExecuteJavascript("updateValues(" + gaugeCol.ToArray().ToString() + ")");
This only displays the variable type instead of the actual values.
Thank you