In JavaScript arrays are collections, and objects are dictionaries. As json is based on JavaScript syntax, any .net IEnumable or ICollection will be mapped to a json array.
in .net json deserialization ICollection and IEnumerable are interfaces, with no constructor. This mean if you are binding to one they must exist or you need to supply a custom serializer. In practice this means an action parameter can not be an interface.
If the model has Interface property, the model constructor must initialize it.
Note: jquery objects are arrays with extended methods via their prototype.
All-Star
58424 Points
15763 Posts
Re: Fail to set up a jQuery collection
Jun 12, 2020 02:43 PM|bruce (sqlwork.com)|LINK
In JavaScript arrays are collections, and objects are dictionaries. As json is based on JavaScript syntax, any .net IEnumable or ICollection will be mapped to a json array.
in .net json deserialization ICollection and IEnumerable are interfaces, with no constructor. This mean if you are binding to one they must exist or you need to supply a custom serializer. In practice this means an action parameter can not be an interface. If the model has Interface property, the model constructor must initialize it.
Note: jquery objects are arrays with extended methods via their prototype.