本帖最后由 doudou798 于 2015-01-23 21:01:30 编辑

解决方案 »

  1.   

    可以用streamreader读取到所有行到数组,然后自己分析每行,根据规则分组
      

  2.   

    using System;
    using System.IO;class Test 
    {
        public static void Main() 
        {
            try 
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                using (StreamReader sr = new StreamReader("TestFile.txt")) 
                {
                    String line;
                    // Read and display lines from the file until the end of 
                    // the file is reached.
                    while ((line = sr.ReadLine()) != null) 
                    {
                        Console.WriteLine(line);
                    }
                }
            }
            catch (Exception e) 
            {
                // Let the user know what went wrong.
                Console.WriteLine("The file could not be read:");
                Console.WriteLine(e.Message);
            }
        }
    }
    这是msdn里的代码..从文档开头一直读到了文件尾。
    你的需求, 只需要再增加一个 变量控制而已.. 在while里加入一个 i<10
      

  3.   

    sorry, 看错题目了.. sorry, 看错题目了..
      

  4.   

    用linq查询,先建立一个对象表,然后按照对象的序号和类型属性进行排序和分组,最后输出
      

  5.   

    如果每种最多只会有10个,那就好办了,用我的思路,使用linq实现就可以了