人生之路,职业之路

读书使人充实,交谈使人机敏,写记使人精确;
“动因+兴趣”——决心-持之以恒-见效
posts - 11, comments - 11, trackbacks - 0, articles - 54
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

C#中获取当前运行目录路径方法

Posted on 2008-03-24 16:03 FreeBird 阅读(617) 评论(0)  编辑 收藏 网摘 所属分类: C#

第一种方法:
 string AppPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
 if (AppPath.EndsWith("\\") || AppPath.EndsWith("/"))
     AppPath= AppPath.Substring(0, AppPath.Length - 1);

第二种方法:
string AppPath = Environment.CurrentDirectory; // 结尾不带"/"


第三种方法:
string AppPath = Directory.GetCurrentDirectory();//获取应用程序的当前工作目录
Directory.SetCurrentDirectory(localFolder); //将应用程序的当前工作目录设置为指定目录



发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 1119878




相关文章:

相关链接: