本文介绍了将二进制文件嵌入类库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将自定义二进制文件嵌入C#类库中,然后在运行时使用二进制读取器读取它?
Is it possible to embed a custom binary file inside a C# class library and then at runtime read it with a binary reader?
我猜可能通过资源是有可能的.
I'm guessing it might be possible through resources.
非常感谢
推荐答案您可以通过通过项目属性将文件添加到资源"中来实现.然后,Visual Studio将使用以下代码为您提供方便的类来访问文件
You can do this by adding the file to the Resources through the project properties. Visual studio will then give you a handy class to access your file using the following code
byte[] theFile = myNamespace.Properties.Resources.theBinaryFile;资源名称为BinaryFile.
Where the resource name is theBinaryFile.
更多推荐
将二进制文件嵌入类库中
发布评论