当前位置:编程学习 > C#/ASP.NET >>

如何将一个二维数组存入到一个一维数组中?

string[] line = new string[9];
            string[][] stations = new string[9][];
            string lineTMP = "";
            string stationTMP = "";
            char[] delimiters = new char[] { '|' };
            int index, i = 0;

            while (true)
            {
                text = sr.ReadLine();
                //Console.WriteLine(text);
                index = 0;

                for (index = 0; ; index++)
                {
                    if (text.Substring(index, 1).Equals(":"))
                    {
                        line[i] = lineTMP;
                        lineTMP = "";
                        break;
                    }
                    else
                        lineTMP += text.Substring(index, 1);
                }
                index++;

                Console.WriteLine(line[i]);

                stationTMP = text.Substring(index);
                //Console.WriteLine(stationTMP);

                stations[i] = stationTMP.Split(delimiters);

                foreach (string ss in stations[i])
                    Console.WriteLine(ss);

                i++;

                if (sr.EndOfStream)
                    break;
            }
            sr.Close();
如何将一个二维数组存入到一个一维数组中? --------------------编程问答-------------------- 用Arraylist吧 挺方便的 取值-插入 --------------------编程问答-------------------- .net2.0里面可以用List
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,