public string[] GetAllVehicles() { Vehicle[] vehicle = _garage.ToArray(); string[] result = new string[_garage.Count()]; // var vehicles = _garage.Where(v => v != null); for (int i = 0; i < vehicle.Length; i++) { if (vehicle[i] != null) { result[i] = string.Format("P-plats {0}: {1}", i + 1, vehicle[i]); } } return(result); }
public string[] GetAllSpaces() { Vehicle[] vehicle = _garage.ToArray(); //_garage.GetAll(); string[] result = new string[vehicle.Length]; for (int i = 0; i < vehicle.Length; i++) { if (vehicle[i] == null) { result[i] = string.Format("P-plats {0} är tom.", i + 1); } else { result[i] = string.Format("P-plats {0}: {1}", i + 1, vehicle[i]); } } return(result); }