C# 如何获取当前项目运行路径的父目录?

from:http://www.dengyukeji.com/thread-135-1-1.html
//获取当前运行路径的上级目录(父目录)
 System.IO.DirectoryInfo topDir = System.IO.Directory.GetParent(System.Environment.CurrentDirectory);
//继续获取上级的上级的上级的目录。
string pathto = topDir.Parent.Parent.FullName;
//注意一个Parent获取上一级的目录。

posted @ 2013-03-15 09:06  Yaoquan.Luo  阅读(8183)  评论(0编辑  收藏  举报