当前位置: 首页>>代码示例>>C#>>正文


C# Int32.CopyTo方法代码示例

本文整理汇总了C#中System.Int32.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Int32.CopyTo方法的具体用法?C# Int32.CopyTo怎么用?C# Int32.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Int32的用法示例。


在下文中一共展示了Int32.CopyTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Transaction t1 = new Transaction("001", "8/10/2012", 78900.00);
            Transaction t2 = new Transaction("002", "9/10/2012", 451900.00);
            t1.showTransaction();
            t2.showTransaction();
            Console.ReadKey();

            Int32[] arrInt = new Int32[] { 7, 6, 9, 65, 8, 3, 5, 4 };

            Int32[] arrIntCopy = new Int32[arrInt.Length];
            //arrInt.CopyTo(arrIntCopy, 0);
            ArraySelection<Int32> arrIntSel = new ArraySelection<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntSel.ElementsCollection = arrIntCopy;
            arrIntSel.Sort();
            Console.Write("array selection sort:\n");
            for (int i = 0; i < arrIntSel.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntSel.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();

            ArrayInsert<Int32> arrIntIns = new ArrayInsert<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntIns.ElementsCollection = arrIntCopy;
            arrIntIns.Sort();
            Console.Write("array Insert sort:\n");
            for (int i = 0; i < arrIntIns.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntIns.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();

            ArrayBubble<Int32> arrIntBub = new ArrayBubble<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntBub.ElementsCollection = arrIntCopy;
            arrIntBub.Sort();
            Console.Write("array Buble sort:\n");
            for (int i = 0; i < arrIntBub.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntBub.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();

            ArrayShell<Int32> arrIntShe = new ArrayShell<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntShe.ElementsCollection = arrIntCopy;
            arrIntShe.Sort();
            Console.Write("array Shell sort:\n");
            for (int i = 0; i < arrIntShe.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntShe.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();

            ArrayMerge<Int32> arrIntMer = new ArrayMerge<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntMer.ElementsCollection = arrIntCopy;
            arrIntMer.Sort();
            Console.Write("array Merge sort:\n");
            for (int i = 0; i < arrIntMer.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntMer.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();

            ArrayQuick<Int32> arrIntQui = new ArrayQuick<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntQui.ElementsCollection = arrIntCopy;
            arrIntQui.Sort();
            Console.Write("array Quick sort:\n");
            for (int i = 0; i < arrIntQui.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntQui.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();

            ArrayHeap<Int32> arrIntHea = new ArrayHeap<Int32>();
            arrInt.CopyTo(arrIntCopy, 0);
            arrIntHea.ElementsCollection = arrIntCopy;
            arrIntHea.Sort();
            Console.Write("array Heap sort:\n");
            for (int i = 0; i < arrIntHea.ElementsCollection.Length; ++i)
            {
                Console.Write("{0} ", arrIntHea.ElementsCollection.GetValue(i).ToString());
            }
            Console.WriteLine();
            Console.ReadKey();
        }
开发者ID:CockDeveloper,项目名称:Alogrithms_Sort_Search,代码行数:96,代码来源:Hello.cs


注:本文中的System.Int32.CopyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。