예제 #1
0
 // 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";
 }
예제 #2
0
 // Here, we pass the car by reference. Changes are persistent.
 private static void doByRef(ref Car car)
 {
     car      = new Car();
     car.Make = "Audi";
 }
예제 #3
0
        // 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);
        }