我正在尝试查看是否可以从 DLL 中提取数据。我做了一些研究,发现您可以在 DLL 中存储应用程序资源。我找不到的是告诉我如何做到这一点的信息。有一篇 MS 文章解释了如何访问卫星 DLL 中的资源,但老实说我不知道这是否是我要找的。 http://msdn.microsoft.com/en-us/library/ms165653.aspx我确实尝试了一些涉及的代码,但是出现了一些“FileNotFoundExceptions”。
显示 DLL 的其余信息:类、对象等。我只是将 DLL 作为资源添加到我的 Visual Studio 项目中,并使用“using”添加它。如果可能的话,我只是不知道如何深入了解它。
最佳答案
如果 dll 是 .net,则可以使用反射。
Using System.Reflection;
....
Assembly A= Assembly.LoadFrom(YouDllFileName);
string[] STA;
STA= A.GetManifestResourceNames();
// STA contains all the resource names in the dll
...
// to extract them
Stream str= A.GetManifestResourceStream(STA[I]);
// then, you can make that stream became a file if you wish
您还可以使用 ildasm 提取 .net 程序集资源
关于c# - 我的 C# 和 DLL 数据问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2646953/