索引i - 1 数据的获取, 与索引i数据 同时获取

            string[] str_test = new string[5] { "AB", "BB", "BC", "AB", "CC" };


            string first = string.Empty;
            for (int i = 0; i < str_test.Length; i++)
            {
                if (!string.IsNullOrEmpty(first))
                {
                    string str = str_test[i]; // 当前i 循环的字符串
                    // first 为 索引为i - 1字符串
                    first = string.Empty;
                }
                first = str_test[i];
            }

你可能感兴趣的:(索引i - 1 数据的获取, 与索引i数据 同时获取)