求一句c#:如果文件"C:\333.txt"存在,则....

解决方案 »

  1.   

    string filePath = Server.MapPath("C/" + 333.txt + "/") + LinDown1.Text; //文件路径if(File.Exists(filePath))//判断文件是否存在
    {
       //则
     }
    else
    {
       Response.Write("不存在该文件");
    }
      

  2.   


      if(System.IO.File.Exists(@"C:\333.txt"))   
      {   
        //存在   
      }   
      

  3.   

    if(File.Exists(@"c:\333.txt))
    {
    ..........
    }
      

  4.   

      File.Exsits(路径加文件名) 存在 返回 True, 不存在返回 False, 
     
      

  5.   

    IF(File.Exists("c:\\333.txt"))
    {
    //后续操作
    }
      

  6.   

    if(File.Exsits(...))
    {
       //则
    }
      

  7.   

    if(File.Exists(@"c:\333.txt))