static void Main(string[] args) { bool equalInt = CompareInt.IsEqual <int>(5, 6); bool equalString = CompareString <string> .AreEqual("3", "3"); string resultInt = equalInt ? " yes " : "no"; string resultString = equalString ? " yes " : "no"; Console.WriteLine($" resultInt: {resultInt} -- resultString : {resultString}"); Console.ReadKey(); }
static void Main(string[] args) { Account accountA = new Account() { Id = 1, Balance = 100 }; Account accountB = new Account() { Id = 2, Balance = 100 }; bool equalInt = CompareInt.IsEqual(5, 6); bool equalString = CompareString.AreEqual("3", "3"); string resultInt = equalInt ? " yes " : "no"; string resultString = equalString ? " yes " : "no"; Console.WriteLine($" are they equal ? resultInt: {resultInt} -- resultString : {resultString}"); Console.WriteLine($" Compare accountA and accountB : { CompareGeneric<Account>.Equal(accountA, accountB)} "); Console.ReadKey(); }