Sep 20, 2011

C# program to copy the array to another array

using System;

namespace DemoArr
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arrSource = { 1, 2, 3, 4, 5 };
            int[] arrDestination = new int[5];

            arrSource.CopyTo(arrDestination, 0);

            foreach (int element in arrDestination)
            {
                Console.Write("{0} ", element); 
            }
            Console.ReadKey(); 

        }
    }
}

No comments:

Post a Comment