通用类中的应用程序路径(.CS)

Anu*_*Anu 1 c#

嗨我想在我的XAML,WPF applcation中使用的一个单独的类中获取applcation路径.在Animals.cs中,

string aPath2 = Application.StartupPath;
 MessageBox.Show(path);
Run Code Online (Sandbox Code Playgroud)

它会调整错误 错误CS0117:'System.Windows.Application'不包含'StartupPath'的定义

我必须将数据提供给treeview,我将从applcation路径中的文件中获取所有详细信息.

Hun*_*hpu 5

使用AppDomain.CurrentDomain.BaseDirectory

StartupPath仅适用于Windows表单