Hi guys,
I'm getting a simple error and I need your help. I want to display every object in a list by returning that object as a string but I'm getting the following error:
The name 'myBikeList' does not exist in the current context
My code:
List<Vehicle> myList;//= new List<Vehicle>();
//METHOD
public override string ToString()
{
foreach (Motorbike bike in myList)
{
string myBikeList = ("[MOTORBIKE]: " + bike.VehicleRegistration + " " + bike.EngineSize
+ " " + bike.Make + " " + bike.Model + " " + bike.EngineSize + " "
+ bike.TopSpeed + "\n");
}
return myBikeList;
}
I am using inheritance if it makes it easier for you to figure out how to solve this problem.
Thanks guys
Joe