using System;
using System.Collections.Generic;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            LinkedList<int> a = new LinkedList<int>();
            a.AddFirst(3);
            a.AddLast(1);
            a.AddLast(4);

            foreach (int i in a)
                Console.Write(i + " ");
            Console.WriteLine();

            LinkedListNode<int> cur = a.Find(3);  //cur对应3所在的位置
            a.AddBefore(cur, 2);                //在3前面添加2

            foreach (int i in a)
                Console.Write(i + " ");

            a.Remove(3);
            a.Clear();
            Console.Read();
        }      
    }
}

 

相关文章:

  • 2021-06-06
  • 2021-05-24
  • 2022-12-23
  • 2021-10-06
  • 2022-02-12
  • 2021-12-25
  • 2021-08-10
猜你喜欢
  • 2021-11-19
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案