StreamReader reader = new StreamReader("c:\\temp\\1.txt",Encoding.Default);
            while (!reader.EndOfStream)
            {
                string s = reader.ReadLine();
                string[] ss = s.Split(new string[]{" "}, StringSplitOptions.RemoveEmptyEntries); //这里得到每一行的分割后的数组,自己写到二维数组吧
            }

解决方案 »

  1.   

    String[] arr = System.IO.File.ReadAllLines("E:\\试验数据.txt");
    取出了所有行
    6行4列的数组是什么意思?
      

  2.   

    string[] strArray = System.IO.File.ReadAllLines(path);
    这样就取到了每一行的数据,然后再对应每一行的数据进行分割。
    分割以后再给6行4列的数组赋值
      

  3.   

    string str = @"   -80.0   31      -20      3
    -80.0   32      -23      5
    -80.0   33      -25      10
    -60.0   31      -18      3
    -60.0   32      -16      5
    -60.0   33      -13      10";
                var ary = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(T => T.Split(new string[]{" "},StringSplitOptions.RemoveEmptyEntries)).ToArray();
                
      

  4.   

    string[] lines = File.ReadAllLines(@"c:\test.txt");
    double[,] results = new double[lines.Length, 4];
    for (int i = 0; i < results.GetLength(0); i++)
    {
    double[] line = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
    for (int j = 0; j < results.GetLength(1); j++)
    results[i, j] = line[j];
    } //输出结果
    foreach (double d in results)
    Console.Write(d + "  ");