Winform中获取文件的路径

winform中获取文件路径(注:下面这些方式需要放在根目录下,否则获取失败)

// 配置文件的目录
        //protected string Root = System.Windows.Forms.Application.StartupPath;  // 获取启动文件的信息,如:E:C#CodeSharingSharinginDebug,等价于System.Environment.CurrentDirectory;和 System.IO.Directory.GetCurrentDirectory()
        //protected string _ExeRoot = System.Windows.Forms.Application.ExecutablePath;  // 获取启动文件的信息,如:E:C#CodeSharingSharinginDebugSharping.exe

// 获取父类路径

原文地址:https://www.cnblogs.com/namejr/p/11469702.html