public void Display(Mylist <T> words)
 {
     foreach (T word in words)
     {
         Console.Write(word + ", ");
     }
     Console.WriteLine();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Mylist <int>    my  = new Mylist <int> ();
            Mylist <string> str = new Mylist <string>();

            my.Add(5);
            my.Add(6);
            my.Add(7);
            my.Add(7);
            my.Add(15);
            Console.WriteLine("Count of elements = " + my.Count);
            my.Display(my);

            int[] arr = new int[my.Count];

            my.CopyTo(arr, 0);

            for (int i = 0; i < arr.Length; i++)
            {
                Console.WriteLine(arr[i]);
            }
        }