コード例 #1
0
        private static void SingleLinkedList()
        {
            LinkedListNodes <int> linkedList = new LinkedListNodes <int>();
            int limitNodes;

            Console.WriteLine("Please type the amount of nodes you might want to create: ");
            limitNodes = Convert.ToInt32(Console.ReadLine());

            for (int i = 1; i <= limitNodes; i++)
            {
                linkedList.Add(new Node <int>(i));
            }
            Node <int> beforeLast = new Node <int>(7);

            linkedList.Add(beforeLast);
            Node <int> last = new Node <int>(8);

            linkedList.Add(beforeLast);
            linkedList.Remove(linkedList.Head, last);
            linkedList.PrintNodes(linkedList.Head);
        }