public void Remove(string value) { CloneProgram previous = null; CloneProgram current = head; while (current != null) { if (current.Value.Equals(value)) { if (previous != null) { previous.Next = current.Next; if (current.Next == null) { previous.Next = null; tail = previous; } } else { head = current.Next; if (head == null) { tail = null; } } //break; } previous = current; current = current.Next; } }
public void Add(string value) { var item = new CloneProgram { Value = value }; if (head == null) { tail = head = item; } else { tail.Next = item; tail = item; } }