static void Main(string[] args) { Terreno t1 = new Terreno() { X = 8, Y = 25 }; Terreno t2 = new Terreno() { X = 10, Y = 20 }; Console.WriteLine(t1); Console.WriteLine(t2); Console.WriteLine(t1 == t2); Console.WriteLine(t1 != t2); Console.WriteLine(t1.Equals(t2)); Console.WriteLine(t1.GetHashCode()); Console.WriteLine(t2.GetHashCode()); Console.WriteLine(); var t3 = t1 + t1; Console.WriteLine(t3); var t4 = t3 + 4; Console.WriteLine(t4); var t5 = 20 + t4; Console.WriteLine(t5); Console.ReadKey(); }
static void Main(string[] args) { Terreno t1 = new Terreno() { X = 8, Y = 25 }; Terreno t2 = new Terreno() { X = 10, Y = 20 }; Console.WriteLine(t1); Console.WriteLine(t2); Console.WriteLine(t1 == t2); Console.WriteLine(t1 != t2); Console.WriteLine(t1.Equals(t2)); Console.WriteLine(t1.GetHashCode()); Console.WriteLine(t2.GetHashCode()); Console.WriteLine(); var t3 = t1 + t1; Console.WriteLine(t3); var t4 = t3 + 4; Console.WriteLine(t4); var t5 = 20 + t4; Console.WriteLine(t5); Console.ReadKey(); }
public override bool Equals(object obj) { Terreno t = (Terreno)obj; return(this == t); }