Copying elements between arrays : Array Copy : Data Structure C# Examples


C# Examples » Data Structure » Array Copy »

 

Copying elements between arrays









    
using  System;
using  System.Collections;
using  System.Collections.Generic;
using  System.Collections.ObjectModel;
using  System.Text;


public  class  MainClass
{

        public  static  void  Main()
        {
                int[]  srcArray  =  new  int[]  {  1,  2,  3  };
                int[]  destArray  =  new  int[]  {  4,  5,  6,  7,  8,  9  };

                Array.Copy(srcArray,  destArray,  srcArray.Length);
                srcArray.CopyTo(destArray,  0);
                srcArray.CopyTo(destArray,  3);
                Array.Copy(srcArray,  0,  destArray,  2,  srcArray.Length);

        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Array Copy