Via
Bim Jeam, and now in colour.
First time it took several days. Second time it took 3 hours. Hope next time it will be easier to google.
//In Html file’s Javascript
window.external.ArrayReceivingFunction(["Arg1", "Arg2", "Arg3", etc.]);
//C# "window.external" class
public class WindowExternal
{
public void ArrayReceivingFunction(object argArray)
{
object[] objArr = DispatchHelpers.GetObjectArrayFrom__COMObjectArray(argArray);
}
}
//C# Dispatch Helpers class
internal class DispatchHelpers
{
internal static object[] GetObjectArrayFrom__COMObjectArray(object comObject)
{
int length = Convert.ToInt32(GetPropertyValue(comObject, "length"));
object[] objArr = new object[length];
for (int idx = 0; idx < length; idx++)
objArr[idx] = GetPropertyValue(comObject, idx.ToString());
return objArr;
}
internal static object GetPropertyValue(object dispObject, string property)
{
object res = null;
try
{
Type type = dispObject.GetType();
res = type.InvokeMember(property, BindingFlags.GetProperty, null, dispObject, null);
}
catch (COMException) { }
return res;
}
}