0
点赞
收藏
分享

微信扫一扫

(64)C#里使用GetCurrentDirectory()、Exists()、CreateDirectory()、 Environment.CurrentDirectory

一脸伟人痣 2022-01-20 阅读 33

(64)C#里使用GetCurrentDirectory()、Exists()、CreateDirectory()、 Environment.CurrentDirectory

在C#开发里,经常需要操作文件相关的内容,比如获取当前目录,这时候需要使用函数GetCurrentDirectory(),它的定义如下:

public static string GetCurrentDirectory ();

获取应用程序的当前工作目录。

返回:String类型;一个字符串,该字符串包含当前工作目录的绝对路径且不以反斜杠 (\) 结尾。

如果一个目录是否存在,就需要使用函数Exists()来判断,当函数认为目录存在,就返回true,当访问出错,或者不存在就返回false。这个当函数定义如下:

举报

相关推荐

0 条评论