请问下 我该如何用c# 新建一个文件 请说的详细点 谢谢

解决方案 »

  1.   

    比如txtStreamWriter SW;
        SW=File.CreateText("c:\test.txt");
        SW.WriteLine("第1行");
        SW.WriteLine("第2行");
        SW.Close();
        Console.WriteLine("文件创建成功");
      

  2.   


    using   System; 
    using   System.IO; public   class   Testfloat 

    public   Testfloat() 

    File.Create( "xx.dbf "); //例如创建dbf文件
    } public   static   void   Main() 

    new   Testfloat(); 
    } } File.Create( "tt.dbf ")
      

  3.   

    //先判断文件是否存在,不存在再创建
    if(!File.Exists("路径")){
    File.Create( "路径")
    }