您的位置:首页 > 职场人生

《程序员的第一年》---------- C# 在非web程序取目录笔记

2013-05-21 11:20 411 查看
///// <summary>
///// 在非web程序取目录
///// </summary>
///// <param name="strPath"></param>
///// <returns></returns>
//private  string MapPath(string strPath)
//{
//    if (HttpContext.Current != null)
//    {
//        return HttpContext.Current.Server.MapPath(strPath);
//    }
//    else //非web程序引用
//    {
//        strPath = strPath.Replace("/", "\\");
//        if (strPath.StartsWith("\\"))
//        {
//            //strPath = strPath.Substring(strPath.IndexOf('\\', 1)).TrimStart('\\');
//            strPath = strPath.TrimStart('\\');
//        }
//        return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);
//    }
//}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: