相关疑难解决方法(0)

确定应用程序根目录的最佳方法是什么?

我需要在我的应用程序根目录中获取所有dll.最好的方法是什么?

string root = Application.StartupPath;
Run Code Online (Sandbox Code Playgroud)

要么,

string root = new FileInfo(Assembly.GetExecutingAssembly().Location).FullName;
Run Code Online (Sandbox Code Playgroud)

在那之后,

Directory.GetFiles(root, "*.dll");
Run Code Online (Sandbox Code Playgroud)

哪种方式更好?还有更好的方法吗?

.net c# winforms

50
推荐指数
3
解决办法
8万
查看次数

标签 统计

.net ×1

c# ×1

winforms ×1