get current directory
Published: 13. December 2008 | Updated: 13. December 2008License: Microsoft Public License (MS-PL)
Categories: Framework » Reflection
Tags: C# Reflection
Get current directory (startup path) in three various ways
Import namespaces
using System.IO; using System.Reflection; using System.Windows.Forms;
Code
// using Directory class string path = Directory.GetCurrentDirectory(); // using Application class string path = Application.StartupPath; // or using reflection string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
| Send us feedback about this snippet » |





