public void Add(string content) { Node node = new Node(); node.Data = content; if(Head == null) { Head = node; } else { current.Next = node; } current = node; }
public bool delete(int Position) { current = Head; if(Position == 1) { Head = current.Next; current.Next = null; current = null; return true; } if(Position > 1) { Node tempNode = Head; Node lastNode = null; int count = 0; while(tempNode != null) { if(count == Position -1) { lastNode.Next = tempNode.Next; tempNode.Next = null; return true; } count++; lastNode = tempNode; tempNode = tempNode.Next; } } return false; }