这段代码什么意思
public static ArrayList RetrieveData()
        {
            ArrayList set = new ArrayList();            if (File.Exists("students.txt") && CheckedFile())
            {
                FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.Default);
                string temp = null;                while ((temp = sr.ReadLine()) != null)
                {
                    set.Add(temp);
                }                sr.Close();
                fs.Close();
            }            return set;
        }

解决方案 »

  1.   

    将students.txt里面的内容读取到 ArrayList set = new ArrayList();
    里面并且返回这个ArrayList 
      

  2.   

    那是不是要在文件里新件一个Students.txt的记事本文件来存取信息呢
      

  3.   


    答案相同新建一个Students.txt文件,这个函数就是将Students.txt里面的内容保存到数组set里面的。
      

  4.   

    恩,看到了
    FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                    StreamReader sr = new StreamReader(fs, Encoding.Default);
    这两句的具体意思是什么呢
      

  5.   

    FileStream构筑函数
    使用指定的路径、创建模式和读/写权限初始化 FileStream 类的新实例。 
    参数
    path
    当前 FileStream 对象将封装的文件的相对路径或绝对路径。 mode
    FileMode 常数,确定如何打开或创建文件。 access
    FileAccess 常数,它确定 FileStream 对象访问文件的方式。这将获取 FileStream 对象的 CanRead 和 CanWrite 属性。如果 path 指定磁盘文件,则 CanSeek 为 true。 
    ===========================
    StreamReader
    用指定的字符编码为指定的流初始化 StreamReader 类的一个新实例。
    参数
    stream
    要读取的流。 encoding
    要使用的字符编码。 
      

  6.   

    是不是还有一个方法没有贴出来啊..
    CheckedFile())