c# 判断目录是否存在

时间:2024-10-12 04:33:28

1、引入using System.IO;

2、写代码Directory.Exists(路径)返回的是bool值, true 或 false ,

3、验证一下, 新建一个工程, 添加一个textbox , 一个button在button事件中写代码 if (System.IO.Directory.Ex足毂忍珩ists(textBox_保存目录.Text) == false) { MessageBox.Show("保存路径不存在!"); return; }

c# 判断目录是否存在
© 2025 长短途
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com