private static readonly int bodyShopLocation = 10;
public static void Main()
car.Driving += Car_Driving;
for (var i = 0; i < road.Length; i++)
Console.WriteLine("Car drove entire roadway? " + (car.MilesDriven == road.Length));
Console.WriteLine("Car driving on all wheels? " + (car.Wheels == 4));
Console.WriteLine("Car engine is electric? " + car.Electric);
Console.WriteLine("Car paintjob has changed? " + (car.Color != "blue"));
private static void Car_Driving(int milesDriven, Car car)
if (milesDriven == bodyShopLocation)
private static Car GoToBodyShop(Car car)
public string Color = "blue";
public bool Electric = false;
get { return milesDriven; }
Driving(milesDriven, this);
public delegate void CustomArgsEventHandler(int milesDriven, Car car);
public event CustomArgsEventHandler Driving;
public int BodyShopLocation = 10;