static class 읽기전용컬렉션

{

           static List<int> IntList = new List<int>();

 

           public static void Test()

           {

                     IntList.Add(11);

                     IntList.Add(12);

 

                     var list = GetList();

                     foreach(var value in list)

                     {

                                Console.WriteLine(value);

                     }

           }

 

           static System.Collections.ObjectModel.ReadOnlyCollection<int> GetList()

           {

                     return IntList.AsReadOnly();

           }

}

 

 

 

by 흥배 2015. 3. 26. 08:00