The InvokeAsync accepts only params object[] args, so the array of objects is parsed as a single, top-level entry in args. You have to pass the array of objects as a single object by casting. The following code only passes the single array object.
await JSRuntime.InvokeAsync<object>("debugOut", new Person[] {
new Person{FirstName=" Nancy",LastName=” Davolio”},
new Person{FirstName=" Andrew", LastName=” Fuller”}
});
By casting the array into an object, it retrieves all the values.
await JSRuntime.InvokeAsync< object >("debugOut", (object) new Person[] {
new Person{FirstName=" Nancy",LastName=” Davolio”},
new Person{FirstName=" Andrew", LastName=” Fuller”}
});
The InvokeAsync accepts only params object[] args, so the array of objects is parsed as a single, top-level entry in args. You have to pass the array of objects as a single object by casting. The following code only passes the single array object.
[JS helper]
[Razor]
By casting the array into an object, it retrieves all the values.
need an explanation for this answer? contact us directly to get an explanation for this answer