C#程序设计及代码-刘兵第11章课件教学.pptVIP

  • 2
  • 0
  • 约 62页
  • 2017-01-01 发布于广东
  • 举报

C#程序设计及代码-刘兵第11章课件教学.ppt

C# 程序设计 刘兵 制作 第11章 文件操作 文件的创建、复制、移动、删除 文件的读写 目录管理 例:目录操作 string path = @c:\MyDir; string target = @c:\TestDir; try { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (Directory.Exists(target)) { Directory.Delete(target, true); } Directory.Move(path, target); File.CreateText(target + @\myfile.txt); Console.WriteLine(在{0}目录中的文件个数是:{1}个。, target, Directory.GetFiles(target).Length); } catch (Exception e) { Console.WriteLine(操作错误原因是: {0}, e.ToString()); } finally { }

文档评论(0)

1亿VIP精品文档

相关文档