public static void compare(Human value1, Human value2) { if (value1.Equals(value2)) { Console.WriteLine("true"); } else { Console.WriteLine("false");//всегда False? }; }
static void Main(string[] args) { var humanOne = new Human(23, "Eric", "Eliot"); Console.WriteLine("{0}, {1}, {2}", humanOne.BirthDate, humanOne.FirstName, humanOne.LastName); Console.WriteLine("---------------------------------"); var humanTwo = new Human(65, "Mark", "Bartra"); Console.WriteLine("{0}, {1}, {2}", humanTwo.BirthDate, humanTwo.FirstName, humanTwo.LastName); Console.WriteLine(humanOne.Equals(humanOne)); Console.WriteLine(humanTwo.Equals(humanOne)); }
static void PrintHumanComparison(Human human1, Human human2) { Console.WriteLine("Is human ({0}) equal to human2 ({1})? {2}", human1.ToString(), human2.ToString(), (human1.Equals(human2)).ToString()); }