public void DisplayTrain() { builder = new StringBuilder(); builder.Append("ENGINE=>"); Coach <T> current = Engine; while (current.Next != null) { current = current.Next; builder.Append(current.Value); builder.Append("=>"); } builder.Append("CLOSE"); Console.WriteLine(builder.ToString()); }
private Coach <T> FindNode(T value) { Coach <T> current = Engine; while (current != null) { if (current.Value == null) { current = current.Next; continue; } if (current.Value.ToString().Equals(value.ToString())) { return(current); } current = current.Next; } return(null); }
public Train() { Engine = new Coach <T>(null); }
public Coach(T value) { Value = value ?? default; Next = null; }