public static DriverAndCarsPackage GetPackageCopy(this DriverAndCarsPackage source)
        {
            DriverAndCarsPackage package = new DriverAndCarsPackage();
              package.Driver = source.Driver.GetPrimitiveCopy();

              foreach (CarPrimitive carPrimitive in source.Cars)
              {
            package.Cars.Add(carPrimitive.GetPrimitiveCopy());
              }
              return package;
        }
Ejemplo n.º 2
0
        public static DriverAndCarsPackage GetDriverAndCarsPackage(this Driver driver)
        {
            DriverAndCarsPackage result = new DriverAndCarsPackage();

              if (driver != null)
              {
            result.Driver = driver.GetPrimitive();

            if (driver.Cars != null)
            {
              foreach(Car car in driver.Cars)
              {
            result.Cars.Add(car.GetPrimitive());
              }
            }
              }
              return result;
        }