Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application path in General class (.CS)

Tags:

c#

Hi i want to get applcation path in one seperate class used in my XAML,WPF applcation. In Animals.cs,

string aPath2 = Application.StartupPath;
 MessageBox.Show(path);

It shws error error CS0117: 'System.Windows.Application' does not contain a definition for 'StartupPath'

I have to give data to treeview,im taking that all details from file in applcation path.

like image 649
Anu Avatar asked Aug 11 '26 23:08

Anu


1 Answers

Use AppDomain.CurrentDomain.BaseDirectory

StartupPath was only for Windows forms

like image 189
Hun1Ahpu Avatar answered Aug 15 '26 06:08

Hun1Ahpu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!