Exemple #1
0
 public void Write(Stream destinationStream, CarCollection cars)
 {
     using (var writer = new BinaryWriter(destinationStream))
     {
         InternalWrite(cars, writer);
     }
 }
Exemple #2
0
        private bool CreateCar(CarModel car)
        {
            Car newCar = new Car()
            {
                Id              = car.Id,
                Brand           = car.Brand,
                Model           = car.Model,
                Year            = car.Year,
                Price           = car.Price,
                Horsepower      = car.Horsepower,
                Torque          = car.Torque,
                Acceleration    = car.Acceleration,
                Topspeed        = car.Topspeed,
                CarClass        = car.CarClass,
                Fuel            = car.Fuel,
                FuelConsumption = car.FuelConsumption,
                MadeByUser      = GetCurrentLoggedInUserId()
            };

            int createdCarId = new CarCollection().Create(newCar);

            if (createdCarId > 0)
            {
                SaveImage(car.Image, createdCarId);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void WhenWritingDefaultCarCollection_ThenValidDefaultJsonDataStored()
        {
            var cars = new CarCollection
            {
                CarRecords =
                {
                    new CarRecord
                    {
                        Date      = "10.10.2008",
                        BrandName = "Alpha Romeo Brera",
                        Price     = 37000
                    }
                }
            };

            var data = new byte[84];
            var ms   = new MemoryStream(data, true);

            _serializer.Write(ms, cars);

            var actualJsonData   = Encoding.UTF8.GetString(data);
            var expectedJsonData = @"{""CarRecords"":[{""Date"":""10.10.2008"",""BrandName"":""Alpha Romeo Brera"",""Price"":37000}]}";

            Assert.AreEqual(expectedJsonData, actualJsonData);
        }
    static void Main()
    {
        CarCollection cars = new CarCollection();

        cars.Add(new Car {
            Make = "Ford", Model = "Mustang"
        });
        cars.Add(new Car {
            Make = "Honda", Model = "Accord"
        });
        cars.Add(new Car {
            Make = "Toyota", Model = "Tundra"
        });

        using (MemoryStream memoryStream = new MemoryStream())
        {
            DataContractSerializer serializer
                = new DataContractSerializer(typeof(CarCollection));
            serializer.WriteObject(memoryStream, cars);
            memoryStream.Position = 0;

            String xml = null;
            using (StreamReader reader = new StreamReader(memoryStream))
            {
                xml = reader.ReadToEnd();
                reader.Close();
            }
            memoryStream.Close();
        }
    }
Exemple #5
0
        /// <summary>
        /// metoda tworzy nowy obiekt klasy Car i dodaje go do kolekcji CarCollection
        /// </summary>
        public void LoadCar()
        {
            //utworzenie instancji klasy Car
            Car car = new Car();

            //dodanie instancji klasy Car do Canvasu
            AddToCanvas(car);

            //losowanie predkosci dla utworzonego obiektu klasy Car
            car.CarSpeed = rnd.NextDouble();
            //predkosc obiektu klasy Car musi byc co najmniej rowna 0,4
            if (car.CarSpeed < 0.4)
            {
                car.CarSpeed += 0.4;
            }

            //sprawdzenie czy kolekcja zawiera przynajmniej 1 item oraz czy zaden z jej itemow nie posiada juz przypisanej ktoremus obiektowi predkosci
            if (CarCollection.Any(x => x.CarSpeed == car.CarSpeed) && CarCollection.Count != 0)
            {
                while (CarCollection.Any(x => x.CarSpeed == car.CarSpeed))
                {
                    //jezeli ktorys obiekt w kolekcji posiada ta sama predkosc co dodawany samochodzik
                    //predkosc nowego samochodziku jest losowana ponownie tak dlugo az bedzie unikalna
                    car.CarSpeed = rnd.NextDouble();
                    if (car.CarSpeed < 0.4)
                    {
                        car.CarSpeed += 0.4;
                    }
                }
            }
            //dodanie obiektu klasy Car do kolekcji
            CarCollection.Add(car);
            //wywolanie metody poruszajacej samochodzik po Canvasie
            pathBuilder.MoveCarMatrix(car);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            CarCollection a  = new CarCollection();
            string        op = "";

            while (true)
            {
                Console.WriteLine("\n === MENU ===");
                Console.WriteLine("1. Them xe moi");
                Console.WriteLine("2. In danh sach xe");
                Console.WriteLine("3. Ket thuc ");
                Console.Write(" >> nhap ma so chuc nang [1-3]: ");

                op = Console.ReadLine().Trim();
                switch (op)
                {
                case "1":
                    a.add(); break;

                case "2":
                    a.display(); break;

                case "3":
                    return;

                default:
                    break;
                }
            }
        }
Exemple #7
0
        public static bool IsCarCollectionsEqual(CarCollection c1, CarCollection c2)
        {
            if (c1 == c2)
            {
                return(true);
            }
            if (c1.CarRecords == c2.CarRecords)
            {
                return(true);
            }
            if (c1.CarRecords.Count != c2.CarRecords.Count)
            {
                return(false);
            }
            for (int i = 0; i < c1.CarRecords.Count; i++)
            {
                var car1 = c1.CarRecords[i];
                var car2 = c2.CarRecords[i];
                if (car1.Price != car2.Price || car1.BrandName != car2.BrandName || car1.Date != car2.Date)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #8
0
        private void Setuppage()
        {
            CarCollection carlst = new CarCollection();
            CarDao cardao = new CarDao();
            carlst = cardao.Load();

            //ComboBox1.DataTextField = "Name";

            for (int i = 0; i < 500; i++)
            {

                foreach (Car item in carlst)
                {

                    lstCars.Items.Add(new ListItem(item.Name, item.CarId));
                    //ComboBox1.Items.Add(new ListItem(item.Name, item.CarId));
                }
            }

            //ObjectDataSource ods = new ObjectDataSource("CarDao", "Load");

            //ComboBox1.DataTextField = "Name";
            //ComboBox1.DataValueField = "CarId";
            //ComboBox1.DataSource = this.carcollection;

            this.carcollection = carlst;
        }
Exemple #9
0
    private void SetUpCars()
    {
        CarCollection carCollection = FindObjectOfType <CarCollection>();

        if (carCollection == null)
        {
            Debug.Log("CarCollection not found");
        }
        m_cars           = new GameObject[m_carCount];
        m_carControllers = new CarController[m_carCount];
        m_ranking        = new int[m_carCount];
        for (int i = 0; i < m_carCount; ++i)
        {
            GameObject carPrefab;
            carCollection.GetCarPrefab(out carPrefab, 0);
            m_cars[i]      = Instantiate(carPrefab, m_race.transform);
            m_cars[i].name = "Car" + i;
            m_cars[i].transform.position = m_initialPositions[i].position;
            m_cars[i].transform.rotation = m_initialPositions[i].rotation;
            m_carControllers[i]          = m_cars[i].GetComponent <CarController>();
            m_carControllers[i].SetId(i);
            m_ranking[i] = -1;
        }
        m_nextRank = 0;
    }
        private void butSaveModifiedCars_Click(object sender, EventArgs e)
        {
            if (this.bsCars.DataSource != null)
            {
                if (MessageBox.Show("You are about to save the changes to your carfiles. This is irreversible. Continue ?", "Are you sure ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    this.UseWaitCursor = true;
                    this.EnableControlsIfDirtyCarCollection(false);

                    this.lbLog.ClearLog();
                    this.lbLog.ScrollToLast = true;
                    CarCollection colCars = (CarCollection)this.bsCars.DataSource;

                    BackgroundWorker SaveCarsWorker = new BackgroundWorker();
                    SaveCarsWorker.WorkerReportsProgress = true;
                    SaveCarsWorker.DoWork             += new DoWorkEventHandler(SaveCarsWorker_DoWork);
                    SaveCarsWorker.ProgressChanged    += new ProgressChangedEventHandler(SaveCarsWorker_ProgressChanged);
                    SaveCarsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(SaveCarsWorker_RunWorkerCompleted);

                    ArrayList        param      = new ArrayList();
                    List <NR2003Car> targetCars = this.colCars.GetModifiedCars();

                    param.Add(SaveCarsWorker);
                    param.Add(targetCars);

                    SaveCarsWorker.RunWorkerAsync(param);
                }
            }
        }
        public static string ReturnCarCollectionOverview(DataSet dataSet)
        {
            var categoriesTable = dataSet.Tables[0];
            var detailTable     = dataSet.Tables[1];

            var collectionContainer = new CarCollectionOverview();

            for (var x = 0; x < categoriesTable.Rows.Count; x++)
            {
                var collection = new CarCollection(categoriesTable.Rows[x][0].ToString());
                collectionContainer.AddCategory(collection);
            }

            for (var i = 0; i < detailTable.Rows.Count; i++)
            {
                var car = new CarDetail(detailTable.Rows[i][0].ToString(), detailTable.Rows[i][1].ToString(),
                                        detailTable.Rows[i][2].ToString(), detailTable.Rows[i][3].ToString(),
                                        detailTable.Rows[i][4].ToString(), detailTable.Rows[i][5].ToString(),
                                        detailTable.Rows[i][6].ToString(), detailTable.Rows[i][7].ToString(),
                                        detailTable.Rows[i][8].ToString(), detailTable.Rows[i][9].ToString(),
                                        detailTable.Rows[i][10].ToString());

                var collection = collectionContainer.FindCollectionByName(detailTable.Rows[i][1].ToString());
                collection.AddCar(car);
            }

            return(collectionContainer.ToJson());
        }
 public void Write(Stream destinationStream, CarCollection cars)
 {
     using (var writer = new StreamWriter(destinationStream))
     {
         _serializer.Serialize(writer, cars);
     }
 }
Exemple #13
0
        public void WhenWritingDefaultCarCollection_ThenValidDefaultXmlDataStored()
        {
            var cars = new CarCollection
            {
                CarRecords =
                {
                    new CarRecord
                    {
                        Date      = "10.10.2008",
                        BrandName = "Alpha Romeo Brera",
                        Price     = 37000
                    }
                }
            };

            var data = new byte[285];
            var ms   = new MemoryStream(data, true);

            _serializer.Write(ms, cars);

            var actualXmlData = Encoding.UTF8.GetString(data);
            // let's skip BOM
            int isEqual = string.CompareOrdinal(actualXmlData, 1, XmlData, 0, XmlData.Length);

            Assert.AreEqual(isEqual, 0);
        }
Exemple #14
0
 public void Write(Stream destinationStream, CarCollection cars)
 {
     using (var writer = new StreamWriter(destinationStream, System.Text.Encoding.UTF8))
     {
         _serializer.Serialize(writer, cars);
     }
 }
        private void CarIsDirtyChanged(object sender, EventArgs <bool> e)
        {
            this.SetSelectModifiedButtonText();

            try
            {
                int       carIndex = -1;
                NR2003Car car      = (NR2003Car)sender;

                CarCollection colCars = (CarCollection)this.bsCars.DataSource;
                carIndex = colCars.IndexOf(car);

                if (carIndex != -1)
                {
                    if (e.ArgObject == true)
                    {
                        this.dgCars.Rows[carIndex].DefaultCellStyle.BackColor = Color.LightBlue;
                    }
                    else
                    {
                        this.dgCars.Rows[carIndex].DefaultCellStyle.BackColor = Color.White;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
 private static void ShowCars(ref CarCollection<Car> carCollection)
 {
     for (int i = 0; i < carCollection.Count; i++)
     {
         Console.WriteLine("CarName -> {0}  Manufactured -> {1}", carCollection[i].Name, carCollection[i].ManufactureDate);
     }
 }
Exemple #17
0
 static void PrintCarCollection(CarCollection coll)
 {
     foreach (CoCarClass car in coll)
     {
         Console.WriteLine("ID: {0} Make: {1} Color: {2} PetName: {3}", car.CarID,
                           car.Make, car.Color, car.PetName);
     }
 }
Exemple #18
0
 static void PrintCarCollection(CarCollection coll)
 {
     foreach(CoCarClass car in coll)
     {
         Console.WriteLine("ID: {0} Make: {1} Color: {2} PetName: {3}", car.CarID,
             car.Make, car.Color, car.PetName);
     }
 }
Exemple #19
0
        public async Task <List <CarModel> > GetCarsByModel(string model)
        {
            var cars        = new List <CarModel>();
            var carsByModel = CarCollection.Find(car => car.Model == model);
            await carsByModel.ForEachAsync(doc => cars.Add(doc));

            return(cars);
        }
Exemple #20
0
        public async Task <List <CarModel> > GetCars()
        {
            var cars = new List <CarModel>();

            var allDocuments = CarCollection.Find(new BsonDocument());
            await allDocuments.ForEachAsync(doc => cars.Add(doc));

            return(cars);
        }
Exemple #21
0
        /// <summary>
        /// A Method to delete the car asynchronously.
        /// </summary>
        /// <returns></returns>
        private async Task DeleteCarAsync()
        {
            using (var a9 = new Asphalt9Entities())
            {
                using (var transaction = a9.Database.BeginTransaction())
                {
                    try
                    {
                        // Finding the requested car from entities.
                        var carToDelete = a9.Grandes
                                          .FirstOrDefault(item => string.Concat(item.Brand, " ", item.CarName).Equals(Car.FullName));

                        var imgName = carToDelete?.CarImage;

                        if (carToDelete != null)
                        {
                            // Deleting the car asynchronously.
                            await DeleteCarAsync(a9, carToDelete, transaction);

                            // Removing the car from car collection as well as empty the car property.
                            var currentDispatcher = Application.Current.Dispatcher;
                            currentDispatcher?.Invoke(() =>
                            {
                                if (Car == null)
                                {
                                    return;
                                }
                                CarCollection.Remove(Car);

                                _car = new Car();
                                RaisePropertyChanged(nameof(Car));
                            });

                            // Notifying that the operation succeeded.
                            Status = $"{carToDelete.Brand} {carToDelete.CarName} Has Been Deleted Successfully.";

                            // Avoiding "The Image used by another process" warning issue.
                            // Not good practice but anyway.
                            GC.Collect();
                            GC.WaitForPendingFinalizers();

                            // Deleting the car image from app images directory.
                            if (FileHelpers.IsImageExist(imgName))
                            {
                                File.Delete(FileHelpers.ImagePath(imgName));
                            }
                        }
                    }
                    catch
                    {
                        // Rolling back adding the car in case an error occurred.
                        transaction.Rollback();
                        Status = @"Error occurred while deleting the car!";
                    }
                }
            }
        }
Exemple #22
0
 static Car GetCar(CarCollection carName)
 {
     if(_availableCars.TryGetValue(carName, out var car))
     {
         return car;
     }
     // or throw an exception or something like that.
     return null; 
 }
Exemple #23
0
        public CarIterator(CarCollection collection, bool reverse = false)
        {
            this._collection = collection;
            this._reverse    = reverse;

            if (reverse)
            {
                this._position = collection.getItems().Count;
            }
        }
Exemple #24
0
        public frmModifyRatings(CarCollection carCol, NR2003Car currentCar)
        {
            InitializeComponent();
            this.mRMod = new RatingsModifier();
            this.mRMod.CarCollection = carCol;
            this.mRMod.CurrentCar    = currentCar;

            this.mIsDirty      = false;
            this.mTrackIsDirty = false;
        }
Exemple #25
0
        public CarCollection Read(Stream sourceStream)
        {
            var cars = new CarCollection();

            using (var reader = new BinaryReader(sourceStream))
            {
                InternalRead(reader, cars);
            }

            return(cars);
        }
Exemple #26
0
 public void addVehicle <T>(T vehicle)
 {
     if (typeof(Car).IsInstanceOfType(vehicle))
     {
         CarCollection.Add(vehicle as Car);
     }
     else if (typeof(Truck).IsInstanceOfType(vehicle))
     {
         TruckCollection.Add(vehicle as Truck);
     }
 }
Exemple #27
0
        public void OnNavigatedTo(INavigationParameters parameters)
        {
            UnityContainer unity = parameters.GetValue <UnityContainer>("UnityContainer");

            _carService = unity.Resolve <CarService>();
            DeviceType  = "Wat een mooie " + _deviceService.GetDeviceOS() + " telefoon heb jij! :)’";
            foreach (Car c in _carService.GetCars())
            {
                CarCollection.Add(c);
            }
        }
        public static RentalCarsResponse Map(CarCollection response)
        {
            //https://www.google.com/search?q=hertz+logo&tbm=isch&source=iu&ictx=1&fir=n0iDQzzKdolXSM%253A%252CiVtHVwm7oNJmZM%252C_&usg=__OkrVPO57e0GcB8g-3gyFXs088go%3D&sa=X&ved=0ahUKEwiLvKeu0cfbAhXQzlMKHZpCCFkQ9QEIOzAA#imgrc=n0iDQzzKdolXSM:
            var rentalCars = new List <RentalCars>();

            foreach (var car in response.cars)
            {
                var imageurl = response.images.FirstOrDefault(img => img.id == car.image_id);
                var carClass = response.car_classes.FirstOrDefault(cls => cls.id == car.car_class_id);

                var operatorname = "HERTZ";

                if (car.price_all_days < 100)
                {
                    operatorname = "Budget";
                }
                else if (car.price_all_days > 100 && car.price_all_days > 120)
                {
                    operatorname = "Avis";
                }
                else if (car.price_all_days > 120 && car.price_all_days > 150)
                {
                    operatorname = "Enterprise";
                }

                if (imageurl == null)
                {
                    continue;
                }
                rentalCars.Add(new RentalCars
                {
                    Type         = carClass == null? "Compact": carClass.name,
                    Address      = car.location?.pick_up?.address,
                    PricePerDay  = car.price_all_days,
                    Url          = car.deeplink_url,
                    CarImagePath = imageurl.url,
                    CarName      = car.vehicle,
                    IsBestOption = true,
                    OperatorName = operatorname,
                    Amenities    = new RentalCarsAmenities
                    {
                        bags  = car.bags,
                        seats = car.seats,
                        isFreeCancellation = car.value_add != null && car.value_add.free_cancellation.GetValueOrDefault(),
                        isShuttle          = car.mandatory_chauffeur
                    }
                });
            }

            return(new RentalCarsResponse
            {
                RentalCars = rentalCars.Count > 20 ? rentalCars.Take(20).ToList() : rentalCars
            });
        }
Exemple #29
0
        /// <summary>Saves the object's data to the specified stream.</summary>
        /// <param name="stream">The stream to save the object's data to.</param>
        /// <param name="fileFormat">Car file format to save</param>
        /// <param name="carCollection">Saves CurrentCarCollection by default</param>
        public void Save(Stream stream, CarFileFormat fileFormat, CarCollection carCollection = null)
        {
            carCollection = carCollection ?? CurrentCarCollection;
            if (!FileFormats.ContainsKey(fileFormat))
            {
                throw new CarCollectionFormatException("Cannot save because the file format is not supported");
            }

            var serializer = FileFormats[fileFormat].Value;

            serializer.Write(stream, carCollection);
        }
Exemple #30
0
    static void Main(string[] args)
    {
        CarCollection <string> Park = new CarCollection <string>();

        Park.AddCar("Toyota", 1992);
        Park.AddCar("Тойота", 2000);
        Park.AddCar("Форд", 1999);
        Park.AddCar("Мерседес", 2003);

        Console.WriteLine(Park[1]);
        Console.ReadKey();
    }
        static void Main(string[] args)
        {
            CarCollection cc = new CarCollection();
            cc.Sort();

            foreach (var car in cc)
            {
                Console.WriteLine("{0} - {1} - {2} - {3}", car.PetName, car.Make, car.MaxSpeed, car.Year);
            }

            Console.ReadLine();
        }
Exemple #32
0
        public static void Main()
        {
            var c = new CarCollection();

            c = XCar();
            foreach (var k in c.Cars)
            {
                Console.WriteLine(k.Make + " " + k.Model + " " + k.StockNumber);
            }
            c = null;
            Console.ReadLine();
        }
        private void CreateCarRoster()
        {
            try
            {
                if (this.bsCars.DataSource != null)
                {
                    Mod           mod     = (Mod)this.cmbMod.SelectedValue;
                    CarCollection colCars = (CarCollection)this.bsCars.DataSource;

                    List <String> selectedCars = new List <String>();

                    foreach (NR2003Car c in colCars)
                    {
                        if (c.Selected == true)
                        {
                            selectedCars.Add(@"+" + c.FileName);
                        }
                    }

                    if (selectedCars.Count > 0)
                    {
                        frmRosterFileName fFileName = new frmRosterFileName();
                        DialogResult      dRes      = fFileName.ShowDialog();

                        if (dRes == DialogResult.OK)
                        {
                            string filename = fFileName.FileName.Trim();

                            if (filename.EndsWith(".lst"))
                            {
                                filename = filename.Remove(filename.LastIndexOf("."));
                            }

                            filename = filename + ".lst";

                            string[] arrCars = selectedCars.ToArray();
                            File.WriteAllLines(mod.Path + @"\cars\" + filename, arrCars, Encoding.Default);

                            frmNR2003Ratings.ShowMessage("Roster " + filename + " successfully created, containing " + selectedCars.Count.ToString() + " car(s). Reload the mod from the dropdown to see your new roster.", "Save ok");
                        }
                    }
                    else
                    {
                        frmNR2003Ratings.ShowMessage("You did not select any cars", "No cars selected");
                    }
                }
            }
            catch (Exception ex)
            {
                frmNR2003Ratings.ShowError("Error in creating car list: " + ex.ToString());
            }
        }
Exemple #34
0
        // Methods

        public void DoCommand(object newItem)
        {
            int    cmdId      = ID;
            string cmdName    = Name;
            string cmdBrand   = Brand;
            string cmdColor   = Color;
            int    cmdYear    = Year;
            string cmdComment = Comment;

            Car car = _carCatalog.CreatNewCar(cmdId, cmdName, cmdBrand, cmdColor, cmdYear, cmdComment);

            CarCollection.Add(car);
        }
 static void Main(string[] args)
 {
     CarCollection<Car> carCollection = new CarCollection<Car>();
     Car miniVan = new Car();
     miniVan.Name = "MiniVanCar1";
     miniVan.ManufactureDate = DateTime.Parse("01.01.15");
     Car miniCar = new Car();
     miniCar.Name = "Mini";
     miniCar.ManufactureDate = DateTime.Parse("10.10.10");
     carCollection.Add(miniVan);
     carCollection.Add(miniCar);
     ShowCars(ref carCollection);
 }
Exemple #36
0
        public CarCollection Load()
        {
            CarCollection carlst = new CarCollection();

            carlst.Add(new Car("アルファード", "3000000", CarMakerType.TOYOTA));
            carlst.Add(new Car("オデッセイ", "2800000", CarMakerType.HONDA));
            carlst.Add(new Car("レガシー", "2870000", CarMakerType.SUBARU));
            carlst.Add(new Car("カローラ", "1800000", CarMakerType.TOYOTA));
            carlst.Add(new Car("エルグランド", "3200000", CarMakerType.NISSAN));
            carlst.Add(new Car("デリカD5", "2500000", CarMakerType.MITSUBISHI));
            carlst.Add(new Car("GT-R", "5000000", CarMakerType.NISSAN));
            carlst.Add(new Car("ROADSTAR", "2300000", CarMakerType.MAZDA));

            return carlst;
        }
Exemple #37
0
        static void Main(string[] args)
        {
            CarCollection<Auto> auto = new CarCollection<Auto>();
            auto.AddCar("Lexus", 200, 60000);
            auto.AddCar("Mazda", 150, 20000);
            auto.AddCar("BMW", 210, 40000);
            auto.SortByPrice();

            foreach (Auto item in auto)
            {
                Console.WriteLine(item.Name);
            }

            Console.WriteLine("Count:{0} ", auto.Count);
            Console.ReadLine();
        }
Exemple #38
0
        static void Main(string[] args)
        {
            var carCollection = new CarCollection<Car>();

            carCollection.Add(new Car("BMW M3", 2000));
            carCollection.Add(new Car("Ford Mustang", 1967));
            carCollection.Add(new Car("Moskvich 412", 1975));
            carCollection.Add(new Car("Porshe 911", 2015));

            Console.WriteLine("   CAR COLLECTION");
            Console.WriteLine("{0,-15}  {1,-4}", "NAME", "MANUFACTURE YEAR");
            for (int i = 0; i < carCollection.Count; i++)
            {
                Console.WriteLine("{0,-15}  {1,-4}", carCollection[i].Name, carCollection[i].ManufactYear);
            }

            carCollection.Clear();
            Console.WriteLine("\nCollection was cleared. Count = {0}", carCollection.Count);

            Console.ReadKey();
        }