检查c#中路径中是否存在文件夹?

bal*_*569 5 c# directory

如何检查目录中是否RM存在名为的文件夹...我已经通过文本框给出了目录路径,txtBoxInput.Text并且在此路径中我必须检查...有什么建议吗?

Ste*_*ins 11

Path.Combine和Directory.Exists?

http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx

http://msdn.microsoft.com/en-us/library/system.io.directory.exists.aspx

if (Directory.Exists(Path.Combine(txtBoxInput.Text, "RM"))
{
    // Do Stuff
}
Run Code Online (Sandbox Code Playgroud)

  • 就像问题应该是问题一样,答案应该是答案(例如,sans?),以免被视为讽刺. (2认同)
  • 这是一个问题,因为我并不完全确定我正确地理解了这个问题.在现实世界的对话中,我会说"你能用X吗?".根本不是讽刺 - 只是英语. (2认同)
  • 当然听起来像是讽刺. (2认同)