zoukankan      html  css  js  c++  java
  • C#中AppDomain.CurrentDomain.BaseDirectory及各种路径获取方法

    C#中AppDomain.CurrentDomain.BaseDirectory及各种路径获取方法

    string path = "";
    
    //获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。 结果:E:项目Test
    path = Environment.CurrentDirectory;
    // 获取程序的基目录。结果:E:项目Test path = System.AppDomain.CurrentDomain.BaseDirectory; // 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。 结果:E:项目Test path = System.Environment.CurrentDirectory ; // 获取应用程序的当前工作目录,注意工作目录是可以改变的,而不限定在程序所在目录。 结果:E:项目Test path = System.IO.Directory.GetCurrentDirectory(); // 获取和设置包括该应用程序的目录的名称。 结果:E:项目Test path = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
    //获取项目下的Log文件路径 结果:E:项目TestLog path
    = System.Web.HttpContext.Current.Server.MapPath("~/Log");
  • 相关阅读:
    centos 6.5 添加静态ip
    质数因子
    sizeof 和 strlen 的区别
    C++输入带空格的字符串
    字符集合
    汽水瓶
    算法汇总
    Word目录生成
    0-1背包问题的动态规划法与回溯法
    vue父元素调用子组件的方法报undefined
  • 原文地址:https://www.cnblogs.com/cang12138/p/5845122.html
Copyright © 2011-2022 走看看