beta 2中好像io也不能用呀!!!我上次只写using System.IO就提示我错误呀

解决方案 »

  1.   

    bete 2中可以using System.IO;的。
    你直接File newfile=new File("C:\\MyIni.ini");不就ok了。
      

  2.   

    File newfile=new File("C:\\MyIni.ini");还是不行啊???
    是不是 Bete 2 中的System.IO;不能用
      

  3.   

    请注意帮助中的说明:
    "All methods of the File class are static and can therefore be called without having an instance of a file."既然是静态方法,当然不能生成实例。用下面的code:FileStream s = File.Create("c:\\myini.ini");
      

  4.   

    File.Create这个方法返回的是StreamWriter;而且System.IO也是可用的。你这样写就没错了。  using System.IO;
    .......
    StreamWriter s = File.Create("c:\\myini.ini"); 
    s.WriteLine("qqqqq");
    s.WriteLine("wwwww");
    s.close();
    .....
     
      

  5.   

    using System
    using System.IO;
    .......
    StreamReader s = File.OpenText("c:\\myini.ini"); 
    while(s.Peek()!=-1)
    {
    string ReadTxt=s.ReadLine();
    Console.WriteLine(ReadTxt);
    }
    s.close();
    .....
      

  6.   

    using System
    using System.IO;
    .......
    bool aa;
    aa=File.Exists("c:\\1.txt");
    if (aa)
    {
    Console.WriteLine("此文件存在");
    }
    else
    {
    Console.WriteLine("此文件不存在");
    }
    .....