January 9, 2016
How to Get Application Path in C#/CSharp
To get application path in C#/CSharp, we make use of GetExecutingAssembly() static method of Assembly class, which resides in System.Reflection namespace. Example is given below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
using System; using System.Reflection; namespace Hello_World { class Program { static void Main(string[] args) { string path = Assembly.GetExecutingAssembly().Location; Console.WriteLine(path); } } } |