コード例 #1
0
        } // end ToString() method

        /// <summary>
        /// Return a list of each Vehicle attribute
        /// </summary>
        ///
        /// <returns> List of string of attributes for the current instance of vehicles </returns>

        public List <string> GetAttributeList()
        {
            List <string> attributeList = new List <string>();

            // Add each of the Vehicle attributes to the list 'attributeList'
            attributeList.Add(VehicleRego);
            attributeList.Add(Make);
            attributeList.Add(Model);
            attributeList.Add(Year.ToString());
            attributeList.Add(Vehicle_Class.ToString());
            attributeList.Add(Transmission_Type.ToString());
            attributeList.Add(string.Format("{0}-Seater", NumSeats.ToString()));
            attributeList.Add(Colour);
            attributeList.Add(DailyRate.ToString());
            attributeList.Add(Fuel_Type.ToString());
            if (GPS)
            {
                attributeList.Add("GPS");
            } // end if
            if (SunRoof)
            {
                attributeList.Add("sunroof");
            } // end if

            return(attributeList);
        } // end GetAttributeList() method
コード例 #2
0
ファイル: Vehicle.cs プロジェクト: abdulmoiz99/Rent-A-Car
        public string ToCSVString()
        {
            string csvString = "";

            csvString = csvString + Registration + "," + Grade + "," + Make + "," + Model + "," + Year.ToString() + "," + NumSeats.ToString() + "," + Transmission + "," + Fuel + "," + GPS.ToString() + "," + SunRoof.ToString() + "," + DailyRate.ToString() + "," + Colour + "";
            return(csvString);
        }