Hi I have an array of dynamic type which i want to iterate through. But when i say arrayObject.lenght, i get following error:
'object' does not contain a definition for 'length' and no extension method 'length' accepting a first argument of type 'object' could be found
how do i iterate over the array?
[Update]
I post a custom json object using jquery ajax and i have written a model binder for untyped JSON. Here is a screenshot:
Found the solution:
foreach (dynamic item in cartJsonObject)
{
// code here
}
I was trying with for
loop and foreach
using var
type. Changing it to dynamic
solved it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With