如题!

解决方案 »

  1.   

    StreamReader sr = new StreamReader("D:\\a.txt");
                string str;
                string result = "";
                int count= 0;
                int index = 3;//指定行
                while ((str = sr.ReadLine()) != null)
                {
                    if (count>= (index-1))
                    {
                        result += str;
                    }
                    count++;
                }
                MessageBox.Show(result.ToString());
      

  2.   

    public string getindexstr(int index)
            {
                string[] all = File.ReadAllLines("D:\\a.txt");
                return all[index];
            }
      

  3.   

    理解错了
            public string getindexstr(int index)
            {
                string temp;            string[] all = File.ReadAllLines("D:\\a.txt");            for (int i = index; i < all.Length; i++)
                {
                    temp += all[i];
                }
                return temp;
            }