Esempio n. 1
0
        static double GetCarHandlerVehiclesCapacity(CarHandler carHandler)
        {
            MethodInfo methodInfo = carHandler.GetType().GetMethod("CountTotalVehiclesLoadCapacity",
                                                                   new Type[] { typeof(List <Vehicle>) });
            double sumOfcapacity = (double)methodInfo.Invoke(carHandler,
                                                             new object[] { carHandler.Vehicles });

            return(sumOfcapacity);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            PrintInfo();

            CarHandler carHandler = new CarHandler();

            carHandler.Vehicles.AddRange(GetVehiclesList());
            double result = GetCarHandlerVehiclesCapacity(carHandler);

            WriteLine($"Total load capacity: {result}");
        }