using static System.Console;
public T Value { get; set; }
public Node<T> Next { get; set; }
public class LinkedList<T> {
private Node<T> head = null;
public Node<T> Add(T value) {
var node = new Node<T> {Value = value};
if (head == null) head = node;
while (current.Next != null) current = current.Next;
public T Remove(Node<T> node) {
if (head == null) return node.Value;
while (current.Next != null) {
if (current.Next == node) {
current.Next = node.Next;
while (current != null) {
WriteLine(current.Value);
public static void Main(string[] args) {
var ll = new LinkedList<int>();