我正在将 Windows 窗体应用程序转换为 WPF 应用程序。有没有一种方法可以在不引用 System.Windows.Forms 的情况下获取诸如启动路径、用户应用程序数据路径、通用应用程序数据路径等内容?
以前,我使用了 System.Windows.Forms.Application.StartupPath
,但是 System.Windows.Application.Current
对象不包含相同的信息。
最佳答案
您可能想看看 System.Environment.GetFolderPath
.
SpecialFolder
的值枚举很多:
ApplicationData CommonApplicationData CommonProgramFiles Cookies Desktop DesktopDirectory Favorites History InternetCache LocalApplicationData MyComputer MyDocuments MyMusic MyPictures Personal ProgramFiles Programs Recent SendTo StartMenu Startup System Templates
这有帮助吗?
关于c# - "System.Windows.Forms.Application.X"获取启动路径、app数据路径等的WPF是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3603385/