public carList FindAllcar(string nomer) { carList list = new carList(); carListItem item = first; while (item != null) { if (nomer == item.Cars.nomer) { list.Addcar(item.Cars); } item = item.next; } return(list); }
public static void Main(string[] args) { carList list = new carList(new car("porshe0", "puk", "6666", "20.584", 20)); list.Addcar(new car("porshe1", "puk", "6666", "20.584", 2)); list.Addcar(new car("porshe2", "puk", "6666", "20.584", 10)); list.Addcar(new car("porshe3", "puk", "6664", "20.584", 8)); list.Addcar(new car("porshe4", "puk", "6664", "20.584", 6)); list.Addcar(new car("porshe5", "puk", "6666", "20.584", 2)); Console.WriteLine(list); car res = list.Findcar("porshe5"); Console.WriteLine(res); carList resList = list.FindAllcar("6664"); Console.WriteLine(resList); Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }