Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Truck truck = new Truck();
  2. truck.CabType = "Extended";
  3. truck.Wheels = 18;
  4. truck.Color = "white";
  5. truck.Doors = 37;
  6.  
  7. Car car = new Car() { Doors = 4, Color = "blue", Wheels = 4, Seats = 4 };
  8.  
  9. Truck lucasPickup = new Truck() { Wheels = 4, Color = "black", Doors = 4, CabType = "quadcab"};
  10.  
  11. Car mikesMini = new Car() { Doors = 3, Color = "Green", Wheels = 4, Seats = 3 };
  12.  
  13. ObjectDelta carDiff = car.Compare(mikesMini);
  14.  
  15. ObjectDelta truckDiff = truck.Compare(lucasPickup);
  16.  
  17. Console.WriteLine("Car Differences:");
  18. foreach(PropertyDelta ds in carDiff.PropertyDeltas)
  19. {
  20. Console.WriteLine(ds.PropertyName + " Previous Value: " + ds.Value1.ToString() + " : New Value: " + ds.Value2.ToString());
  21. }
  22. Console.WriteLine("Truck Differences:");
  23. foreach (PropertyDelta ds in truckDiff.PropertyDeltas)
  24. {
  25. Console.WriteLine(ds.PropertyName + " Previous Value: " + ds.Value1.ToString() + " : New Value: " + ds.Value2.ToString());
  26. }
  27. Console.Read();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement