从 WPF 应用程序获取应用程序的目录 [英] Getting the application's directory from a WPF application
本文介绍了从 WPF 应用程序获取应用程序的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找到了带有 AppDomain 的 Windows 窗体解决方案,但 WPF Application
对象的等价物是什么?
I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application
object?
推荐答案
一种方法:
System.AppDomain.CurrentDomain.BaseDirectory
另一种方法是:
System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
这篇关于从 WPF 应用程序获取应用程序的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文