开发者

embed Pdf File in DLL and then read it

I want to embed some pdf files in a DLL . I hav开发者_StackOverflow中文版e been made DLL but I can not read it from dll. please help me in this way.


To embed a file in a dll, you need to set the "Build Action" to "Embedded Resource". See the properties of the file in the Solution Explorer.

Then you need to read it as a Stream: GetType().Assembly.GetManifestResourceStream(name), where "name" is the full, case sensitive, namespace path of the file, including extension.

Example: The root-namespace of the project is "AA.BB". In there is a folder "CC" where I put the file "file.ext". Then the name would be: "AA.BB.CC.file.ext".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜