Page 1 of 1

Dictionary.Key.ToArray changes the direction

Posted: Sun Oct 25, 2015 9:30 am
by CyborgDE
Hello,

the function ToArray changes the direction under javascript (since 5.1) :

Code: Select all

                Dictionary<string, object> test = new Dictionary<string, object>();
                test.Add("sender", "sender");
                test.Add("e", "e");

                var array = test.Keys.ToArray();

Result under windows : sender, e
Result under java : e,sender

Regards,
Uwe

Re: Dictionary.Key.ToArray changes the direction

Posted: Sun Oct 25, 2015 12:24 pm
by CyborgDE
Quick workaround in JSIL.Core.js

Code: Select all

JSIL.ObjectHashCode = function (obj, virtualCall, thisType) {
  var type = typeof obj;

  //if (type === "object" || type == "string") {
    //if (obj.GetHashCode && virtualCall)
  if (type === "object") {
    if (obj.GetHashCode)
      return (obj.GetHashCode() | 0);   
    if (!virtualCall && thisType.__PublicInterface__.prototype.GetHashCode)
      return (thisType.__PublicInterface__.prototype.GetHashCode.call(obj) | 0);   
    return JSIL.HashCodeInternal(obj);
  } else {
    // FIXME: Not an integer. Gross.
    return String(obj);
  }
};

Regards,
Uwe