posted by 방랑군 2012. 1. 7. 16:57

출처 :  http://blog.naver.com/PostView.nhn?blogId=alfustnals&logNo=140142248773&categoryNo=41&parentCategoryNo=0&viewDate=&currentPage=1&postListTopCurrentPage=1&from=search

간단예제

  static void Main(string[] args)
 {
    string[] input { "도망노비님의", 
                           "블로그입니다", 
                           "사랑해주세여^^"};

    List<string> listTest = new List<string>(input);

    Console.WriteLine("1번 : \nCapacity: {0}", listTest.Capacity);

    Console.WriteLine();
    foreach (string lst in listTest)
    {
        Console.WriteLine(lst);
    }

    Console.WriteLine("\n");
    listTest.AddRange(listTest);

    Console.WriteLine();


    foreach (string lst in listTest)
    {
        Console.WriteLine("2번 :" + lst);
    }

    Console.WriteLine("\nRemoveRange(2, 2)");
    listTest.RemoveRange(2, 2);

    Console.WriteLine();
    foreach (string lst in listTest)
    {
        Console.WriteLine("3번 : " + lst);
    }

    input = new string[]  { "도망노비님의", 
                                   "블로그입니다", 
                                   "사랑해주세여^^"};

    Console.WriteLine("\nInsertRange(3, input)");
    listTest.InsertRange(3, input);

    Console.WriteLine();
    foreach (string lst in listTest)
    {
        Console.WriteLine(lst);
    }

    Console.WriteLine("\noutput = dinosaurs.GetRange(2, 3).ToArray()");
    string[] output = listTest.GetRange(2, 3).ToArray();

    Console.WriteLine();
    foreach (string lst in output)
    {
        Console.WriteLine(lst);
    }

 }

 MSDN 참고 : http://msdn.microsoft.com/