gpt4 book ai didi

c# - "System.Windows.Forms.Application.X"获取启动路径、app数据路径等的WPF是什么?

转载 作者:可可西里 更新时间:2023-11-01 03:00:05 25 4
gpt4 key购买 nike

我正在将 Windows 窗体应用程序转换为 WPF 应用程序。有没有一种方法可以在不引用 System.Windows.Forms 的情况下获取诸如启动路径、用户应用程序数据路径、通用应用程序数据路径等内容?

以前,我使用了 System.Windows.Forms.Application.StartupPath,但是 System.Windows.Application.Current 对象不包含相同的信息。

最佳答案

您可能想看看 System.Environment.GetFolderPath .

SpecialFolder 的值枚举很多:

ApplicationDataCommonApplicationDataCommonProgramFilesCookiesDesktopDesktopDirectoryFavoritesHistoryInternetCacheLocalApplicationDataMyComputerMyDocumentsMyMusicMyPicturesPersonalProgramFilesProgramsRecentSendToStartMenuStartupSystemTemplates

这有帮助吗?

关于c# - "System.Windows.Forms.Application.X"获取启动路径、app数据路径等的WPF是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3603385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com