获取应用程序的目录,从一个WPF应用程序 [英] Getting the application's directory from a WPF application

查看:147
本文介绍了获取应用程序的目录,从一个WPF应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到解决方案,Windows窗体与应用程序域,但是这将是相当于一个WPF 应用程序对象?

解决方案

一个方法:

  System.AppDomain.CurrentDomain.BaseDirectory
 

另一种方式做到这一点是:

<$p$p><$c$c>System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)

I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application object?

解决方案

One method:

System.AppDomain.CurrentDomain.BaseDirectory

Another way to do it would be:

System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)

这篇关于获取应用程序的目录,从一个WPF应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆