public override string ToString() { return(Name + " National Park\n" + "Location:\t\t" + Location + "\n" + "Established:\t\t" + EstablishDate.ToString() + "\n" + "Area:\t\t\t" + Area.ToString("N") + "sq km\n" + "Annual Visitors:\t" + Visitors.ToString("N").PadLeft(5) + '\n' + Description.ToString()); }
/// <summary> /// Prints formatted park information /// </summary> /// <returns>The formatted string of park information</returns> public override string ToString() { return(Name + " National Park\n\n" + "Location:".PadRight(20) + Location + "\n" + "Established:".ToString().PadRight(20) + EstablishDate.ToString("MM/dd/yyyy") + "\n" + "Area:".ToString().PadRight(20) + Area.ToString("n0") + " sq km\n" + "Annual Visitors:".ToString().PadRight(20) + Visitors.ToString("n0") + "\n\n" + Description); }
public override string ToString() { string message = "Name: " + Name + "\n"; message += "Date: " + EstablishDate.ToString() + "\n"; message += "Hashcode: " + GetHashCode().ToString() + "\n"; message += "Head: " + HeadName; return(message); }