C#怎样判断文件是否存在和文件夹是否存在

来源:互联网 发布:提速软件 编辑:程序博客网 时间:2024/05/06 01:50

计算机/网络书籍!


如果是目录可用:  
   
  DirectoryInfo   TheFolder   =   new   DirectoryInfo(PathName);  
  if   (TheFolder.Exists)  
  {  
  //。。。。。。。。。。。。。  
  }  
   
  如果是文件可用:  
   
  FileInfo   TheFile   =   new   FileInfo(PathName);  
  if   (TheFile.Exists)  
  {  
  //。。。。。。。。。。。。  
  }
using   System.IO;  
  ...  
  if(File.Exists("c:/abc.txt"))  
  {  
      ...  
  }  
  if(Directory.Exists("d:/abc/"))  
  {  
      ...  
  }

秀飞颈椎枕 真实远离颈椎 20天包退 还退快递95.0元 

 

点击返回首页!

点击返回首页!