C#判断指定目录是否存在,不存在就创建之的代码

代码期间,将开发过程中比较好的内容做个珍藏,下面资料是关于C#判断指定目录是否存在,不存在就创建之的代码,希望能对各位有较大用。

if (Directory.Exists(spath))
{
}
else
{
DirectoryInfo directoryInfo = new DirectoryInfo(spath);
directoryInfo.Create();
}

猜你喜欢

转载自blog.csdn.net/weixin_44314274/article/details/86476182