将二进制文件嵌入类库中

编程入门 行业动态 更新时间:2024-10-18 14:26:21
本文介绍了将二进制文件嵌入类库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以将自定义二进制文件嵌入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.

更多推荐

将二进制文件嵌入类库中

本文发布于:2023-11-26 02:47:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632327.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类库   二进制文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!