一、文件目录相关

    1、GetFiles:取目录下的文件

         string[] filenames = Directory.GetFiles(budgetpath);

    2、Path.GetExtension(filename):

         返回值:文件的扩展名,有“.”
       
二、文本文件操作

     1、File.ReadAllLines:将文本所有行读到一个字符串数组中,例如:

          string[] pbsFiles = File.ReadAllLines(sPBSContentFile, Encoding.GetEncoding("gb2312"));

      2、System.IO.Path.GetExtension(tbFilePath.Text); 文件扩展名, 返回值:".txt" 带点 

      3、System.IO.Path.GetFileNameWithoutExtension(文件名):返回值:仅仅包含文件名,不包含文件扩展名和文件路径名

      4、Path.GetDirectoryName(含路劲文件名):返回值:文件的路劲

 

   

 

相关文章:

  • 2021-06-20
  • 2021-06-07
  • 2021-09-25
  • 2021-11-20
  • 2021-08-07
  • 2021-06-26
  • 2021-12-25
  • 2021-08-30
猜你喜欢
  • 2021-12-14
  • 2021-12-21
  • 2021-05-14
  • 2021-10-08
  • 2021-04-25
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案