如何从SaveFileDialog.FileName中仅获取目录名称

Red*_*ron 6 c# string parsing

SaveFileDialog.FileName在C#中处理时,将目录名与文件名分开的最简单方法是什么?

Ada*_*ght 12

使用:

System.IO.Path.GetDirectoryName(saveDialog.FileName)
Run Code Online (Sandbox Code Playgroud)

(和相应的System.IO.Path.GetFileName).Path类非常有用.