I bumped against this issue, that is driving me crazy:
public class Program { static object _a; object _c; public static void Main() { _a = new object(); int ha = _a.GetHashCode(); Debug.Print(ha.ToString()); var b = new object(); int hb = b.GetHashCode(); Debug.Print(hb.ToString()); var p = new Program(); p._c = new object(); int hc = p._c.GetHashCode(); Debug.Print(hc.ToString()); while (true) { Thread.Sleep(1000); } } }
The displayed result is zero in all three the tests. My suspect is about a bug in the framework: the mine is 4.2.
However, the GetHashCode *not always* seems buggy: still not clear, but "sometimes" returns a valid value (i.e. non-zero integer).
Can anyone confirm me whether is it a bug?
Is there anyone may try the above snippet with a more recent (e.g. latest) Netduino firmware?
Thanks everybody!
UPDATE: the objects comparison yields (correctly) a "false" result:
Debug.Print((_a == b).ToString());
???
Edited by Mario Vernari, 17 May 2014 - 07:02 AM.