コード例 #1
0
        static void ListTest()
        {
            MyLinkedList <int> list = new MyLinkedList <int>();

            int N = 20;

            for (int i = 0; i < N; i++)
            {
                Console.WriteLine("Try to Add num: " + i);
                list.Add(i);
            }
            int num = 6;

            Console.WriteLine("\nTry to Search num: " + num);
            int val = list.Search(num);

            Console.WriteLine("Finded number: " + val);
            num = 8;

            Console.WriteLine("\nTry to delete number: " + num);
            list.Delete(num);

            try
            {
                Console.WriteLine("Try to Search num: " + num);
                val = list.Search(num);
            }
            catch (Exception e)
            {
                Console.WriteLine("Number " + num + " not found");
            }

            Console.Read();
        }