blog.jj5.net (2003 to 2005)

Object.Equals()

Thu Mar 18 04:58:00 UTC+1100 2004

Categories:

This is interesting:

      Int16 s = 123;
      Console.WriteLine(s.Equals(123)); // False

Because on the second line 123 is Int32 the equality test returns false.

Further, s.CompareTo(123) would throw an exception.

John.


Copyright © 2003-2005 John Elliot