看书后自己做的一个小总结,方便日后查阅吧,有不明白的也可以看看!

代码 复制 - 运行

            int[] pins; 
            pins = new int[4] { 7, 3, 5, 2 }; 

            foreach (int pin in pins) 
            { 
                Console.WriteLine(pin); 
            } 

            int[] copy; 
            copy = new int[pins.Length]; 

            //1、仅仅是拷贝了数组的内存中的地址 
           //copy = pins; 

            //逐一拷贝数组 
            //for (int i = 0; i < pins.Length; i++) 
            //{ 
            //    copy[i] = pins[i];     
            //} 

            //其它三种拷贝方法 
            pins.CopyTo(copy, 0); 
            //Array.Copy(pins, copy, copy.Length); 
            //copy = (int[])pins.Clone();