When you add a Node as an argument to the addNode() method, it's a reference to the Node object that gets copied, not the Node itself.
As well as a start node, you also need a 'tail' node to hold a reference to the last node added, plus a 'count' variable to hold the number of nodes added.
The following code seems to work OK and should give you a more solid base on which to develop your LinkedList class:
using System;
class Test
{
static void Main()
{
LinkedList li = new LinkedList();
Node n = new Node(11);
li.addNode(n);
n = new Node(12);
li.addNode(n);
n = new Node(13);
li.addNode(n);
n = new Node(14);
li.addNode(n);
li.listNodes();
Console.ReadKey();
}
}
class Node
{
Node next = null;
int val;
public Node (int v)
{
val = v;
}
public Node Next
{
get { return next; }
set { next = value;}
}
public int Value
{
get { return val; }
}
}
class LinkedList
{
Node start;
Node tail;
int count = 1;
public LinkedList()
{
start = new Node(10);
}
public void addNode(Node n)
{
if (count == 1)
{
start.Next = n;
tail = n;
}
else
{
tail.Next = n;
tail = n;
}
count++;
}
public void listNodes()
{
int num = 1;
Node n = start;
while (num <= count)
{
Console.WriteLine("Value of Node {0} = {1}", num, n.Value);
n = n.Next;
num++;
}
}
}