LinkedList Wrong Display(string builder)
<p>The following program is a basic linked list divided in 3 classes.<br>
In the tester class (main) i add several numbers to the list (sorted).<br>
But insteed of getting the numbers as a  result i get the result: <strong>LinkedList.LinkedList</strong><br>
Is something wrong with the stringbuilder (the program was first in java where a string buffer was used, but that should be the same i think?)</p>

<p><strong>LinkedListTester.cs</strong></p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinkedList
{
public class LinkedListTester
{
    static void Main(string[] args)
    {
        LinkedList ll = new LinkedList();
        ll.addDataSorted(5);
        ll.addDataSorted(7);
        ll.addDataSorted(13);
        ll.addDataSorted(1);
        ll.addDataSorted(17);
        ll.addDataSorted(8);
        Console.WriteLine(ll);
    }
}

}/*LinkedList*/
</code></pre>

<p><strong>LinkedList.cs</strong></p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinkedList
{
public class LinkedList
{
    //toestand
    private LinkedListNode first;
    private LinkedListNode last;

    //gedrag
    public LinkedList()
    {
        first = null;
        last = null;
    }

    public void addDataInFront(int data)
    {
        first = new LinkedListNode(data, first);
        if (last == null){
            last = first;
        }
    }/*addDataInFront*/

    public void addDataToBack(int data)
    {
        if (first == null)
        {
            addDataInFront(data);
        }
        else
        {
            last.setNext(new LinkedListNode(data, null));
            last = last.getNext();
        }
    }/*addDataToBack*/

    public void addDataSorted(int data)
    {
        if (first == null || first.getData() &gt; data)
        {
            addDataInFront(data);
        }
        else
        {
            LinkedListNode currentNode = first;
            while (currentNode.getNext() != null &amp;&amp; currentNode.getNext().getData() &lt; data)
            {
                currentNode = currentNode.getNext();
            }

            currentNode.setNext(new LinkedListNode(data, currentNode.getNext()));
            currentNode = currentNode.getNext();

            if (currentNode.getNext() == null)
            {
                last = currentNode;
            }
        }
    }/*addDataSorted*/

    public String toString()
    {
        StringBuilder Buf = new StringBuilder();
        LinkedListNode currentNode = first;
        while (currentNode != null)
        {
            Buf.Append(currentNode.getData());
            Buf.Append(' ');
            currentNode = currentNode.getNext();
        }
        return Buf.ToString();
    }/*toString*/



}/*LinkedList*/

}/*LinkedList*/
</code></pre>

<p><strong>LinkedListNode:</strong></p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinkedList
{
public class LinkedListNode
{
    //toestand
    private int data;
    private LinkedListNode next;
    private LinkedListNode previous;

    //gedrag
    public LinkedListNode(int data, LinkedListNode next)
    {
        this.data = data;
        this.next = next;
        this.previous = null;
    }

    public LinkedListNode(int data, LinkedListNode next, LinkedListNode previous)
    {
        this.data = data;
        this.next = next;
        this.previous = previous;
    }

    public LinkedListNode getNext()
    {
        return next;
    }

    public LinkedListNode getPrevious()
    {
        return previous;
    }

    public void setNext(LinkedListNode next)
    {
        this.next = next;
    }

    public void setPrevious(LinkedListNode previous)
    {
        this.previous = previous;
    }

    public int getData()
    {
        return data;
    }


}/*LinkedListNode*/
}/*LinkedList*/
</code></pre>
