// Here, again, car is passed by value, i.e. only a copy of the // reference is passed in. public static void doByValue(Car car) { car = new Car(); car.Make = "BMW"; }
// Here, we pass the car by reference. Changes are persistent. private static void doByRef(ref Car car) { car = new Car(); car.Make = "Audi"; }
// Here, car is passed by value. Changes made to it are NOT persistent private static double getMarketValue(Car car) { double carValue = (((double)DateTime.Now.Year - (double)car.Year) / 10) * car.OriginalPrice; return(carValue); }