// C# 1 public static void ChangeSomethingAboutACar(CarSpeedChanger speedChanger) { var car = speedChanger.Target as Car; Console.WriteLine($"The original speed of the car was {car.Speed}"); // here were are going to call the function speedChanger(20); Console.WriteLine($"The new speed of the car is {car.Speed}"); }
public static void CSharp1Demo() { var c = new Car(); c.Speed = 65; var del = new CarSpeedChanger(c.Accelerate); ChangeSomethingAboutACar(del); }