static void PrintDoubleLink(DoubleLink <int> d, string text = "输出:")
        {
            int data = 0;

            Console.Write(text);
            for (int i = 0; i < d.GetLength(); i++)
            {
                d.GetElement(i + 1, ref data);
                Console.Write(data.ToString() + " ");
            }
            Console.WriteLine();
        }
        static void TestDoubleLink()
        {
            //添加测试
            DoubleLink <int> d = new DoubleLink <int>();

            d.Add(2);
            d.Add(90);
            d.AddAtFirst(32);
            d.Add(8);
            PrintDoubleLink(d, "添加四个元素后");
            Console.WriteLine();

            //插入测试
            PrintDoubleLink(d, "插入前:");
            d.Inset(1, 88);
            PrintDoubleLink(d, "一号位插入88后:");
            d.Inset(5, 60);
            PrintDoubleLink(d, "五号位插入60后:");
            d.AddAtFirst(99);
            PrintDoubleLink(d, "在头部添加99后:");
            Console.WriteLine();

            //删除测试
            int data = 0;

            PrintDoubleLink(d, "删除元素前:");
            d.Delete(4, ref data);
            PrintDoubleLink(d, "删除第四个元素后:");
            d.Delete(1, ref data);
            d.Delete(1, ref data);
            d.Delete(1, ref data);
            d.Delete(1, ref data);
            d.Delete(1, ref data);
            d.Delete(1, ref data);
            d.Delete(1, ref data);
            PrintDoubleLink(d, "删除完元素后:");
            d.Add(30);
            d.AddAtFirst(20);
            PrintDoubleLink(d, "在添加两个元素后:");
            Console.WriteLine();

            //索引测试
            d.Delete(30, ref data);
            d.Inset(0, 1);
            d.GetElement(0, ref data);
            d.GetElement(-1, ref data);
        }