This project is read-only.

Passing JS Dictionaries to .NET fails

May 8, 2012 at 2:29 AM

The code which converts the JS dictionaries into .NET dictionaries can fail in some cases.

We believe it is because the converter does not use the "hasOwnProperty" to check the properties when it is enumerating them and converting them to .NET.
Here is a suggestion on how you can easily fix this: 

 

for (var key in object) {
    if (object.hasOwnProperty(key)) {
        value = object[key];
        // ... do something with the value ...
    }
}

 

Thanks a lot in advance, for considering putting this in a future update.
Right now we cannot use Dictionaries, and have to use Arrays instead, which is quite cumbersome.

May 8, 2012 at 3:50 AM

Can you please test this fix and provide a patch?