using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Exemplul1
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Array arrInt = Array.CreateInstance(typeof(int), 20);
            for (int i = 0; i < arrInt.Length; i++)
                arrInt.SetValue(arrInt.Length - i - 1, i);

            //ordonarea crescatoare a elementelor din Array 
            Array.Sort(arrInt);


            //parcurgerea elementelor din Array, utilizand un enumerator
            Console.WriteLine("Elemente arrInt");
            IEnumerator enArray = arrInt.GetEnumerator();
            while (enArray.MoveNext())
            {
                string str = enArray.Current.ToString();
                Console.WriteLine(str);
            }
            Console.WriteLine();

            int[] vectInt = new int[arrInt.Length];

            //copierea elementelor array-ului intr-un vector de numere intregi
            Array.Copy(arrInt, vectInt, arrInt.Length);
            Console.WriteLine("Elemente vectInt");

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

        }
    }
}
