2006/06/23 | dll路径
类别(技术文档) | 评论(0) | 阅读(115) | 发表于 12:05

 读取dll自身的路径

  /**//// <summary>
        /// 获取Assembly的运行路径
        /// </summary>
        /// <returns></returns>
        private string GetAssemblyPath()
        {
            string _CodeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase ;

            _CodeBase = _CodeBase.Substring(8,_CodeBase.Length - 8);    // 8是 file:// 的长度

            string[] arrSection = _CodeBase.Split(new char[]{’/’});
            
            string _FolderPath = "";
            for(int i=0;i<arrSection.Length-1;i++) 
            {
                _FolderPath += arrSection[i] + "/";
            }

            return _FolderPath;
        }

0

评论Comments

日志分类
首页[4]
生活小事[2]
技术文档[1]
游戏足迹[1]