本文介绍了获取当前组件的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何获取当前程序集的路径?我需要从相对HTE当前汇编文件(.dll)的位置,一些路径获取数据。
How do I get the path of the current assembly? I need to get data from some paths relative to the location of hte current assembly (.dll).
我还以为有人跟我用的反射命名空间,但我找不到任何东西在里面。
I thought someone told me to use the reflection namespace but I can't find anything in there.
推荐答案
您可以使用:
string path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
这篇关于获取当前组件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!