public void RefEquivalenceCheck() { BoxClass b1 = new BoxClass(1, 2, 3); BoxClass b2 = new BoxClass(1, 2, 3); if (b1.Equals(b2)) { Console.WriteLine("Equal \nVolume = {0} ", b1.Volume()); } else { Console.WriteLine("Not Equal \nVolume = {0} ", b1.Volume()); } }
public void CheckReferenceEqual() { BoxClass b1 = new BoxClass(1, 2, 3); BoxClass b2 = new BoxClass(1, 2, 3); if (Object.ReferenceEquals(b1,b2)) { Console.WriteLine("Ref Equal \nVolume = {0} ", b1.Volume()); } else { Console.WriteLine("Ref Not Equal \nVolume = {0} ", b1.Volume()); } }