using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { link a = new link { }; a.addFirst(new node(1)); a.add(1); a.add(2); a.add(3); a.add(4); a.add(1); a.print(); a.removeAfter(????); a.print(); } } class node { public T data; public node next; public node(T data) { this.data = data; } } class link { node firstNode; node lastnode; public void add(T Node) { node newnode = new node(Node); newnode.next = this.lastnode.next; lastnode.next = newnode; } public void addFirst( node newNode) { newNode.next = firstNode; firstNode = newNode; } public void removeAfter(node node) { node.next = node.next.next; } public void removeBeggining(link link) { if (link.firstNode.next != null) { link.firstNode = link.firstNode.next; } } public void print() { node node = firstNode; while (node.next != null) { Console.WriteLine(node.data); if (node.next != null) { node = node.next; } } } } }