구현해보려고 했으나.. 이미 구현해 놓은 템플릿(더블 링크드 리스트)이 있구나~~
윈엠프의 플레이 리스트.. 네트워크에서 데이터 패킷으로 나눠 전송하고 수신측에서 합칠 때 이런 자료구조를 사용한다.
using System;
using System.Collections.Generic;
namespace LinkedList
{
class Program
{
public static void Main(string[] args)
{
LinkedList<String> test = new LinkedList<String>();
test.AddLast("1");
test.AddLast("2");
test.AddLast("3");
test.AddAfter(test.Find("2"), "2.5");
test.Remove("1");
int i = 1;
foreach (String s in test)
{
Console.WriteLine( "링크드 리스트 {0}째 요소의 값은 {1}", i, s);
i++;
}
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
/*
링크드 리스트 1째 요소의 값은 2
링크드 리스트 2째 요소의 값은 2.5
링크드 리스트 3째 요소의 값은 3
Press any key to continue . . .
*/