亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        C#使用自定義算法對數(shù)組進(jìn)行反轉(zhuǎn)操作的方法

        字號(hào):


            C#的Array對象自帶反轉(zhuǎn)功能,但是下面的代碼完全通過自定義的算法來實(shí)現(xiàn)數(shù)組反轉(zhuǎn)
            代碼如下:
            public static void ReverseArray<T>(this T[] inputArray)
            {
            T temp = default(T);
            if (inputArray == null)
            throw new ArgumentNullException("inputArray is empty");
            if (inputArray.Length > 0)
            {
            for (int counter = 0; counter < (inputArray.Length / 2); counter++)
            {
            temp = inputArray[counter];
            inputArray[counter] = inputArray[inputArray.Length - counter - 1];
            inputArray[inputArray.Length - counter - 1] = temp;
            }
            }
            else
            {
            Trace.WriteLine("Reversal not needed");
            }
            }