Equals int and short c# returns false [duplicate]
问题 This question already has answers here : What is the difference between == and Equals() for primitives in C#? (9 answers) Closed 4 years ago . Consider this code: static int x2 = 10; public static void Main() { short y = 10; Console.WriteLine(y.Equals(x2)); //False Console.Read(); } Why y.Equals(x2) returns false ? 回答1: Int16.Equals specific docs Return Value true if obj is an instance of Int16 and equals the value of this instance; otherwise, false. This was my original answer, whilst it