} // 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
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); }