GetManifestResourceStream用法

项目添加资源文件Resource1.resx
“C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\ResGen.exe” Resource1.resx
从“Resource1.resx”读入 1 资源
正在写入资源文件… 完成。
排除资源文件Resource1.resx
添加文件Resource1.resources属性生成操作嵌入的资源

//记得加入工程名hex.
For example, if the project is called Kernel and the file is Data\Text.txt, then ResourceName = "Kernel.Data.Text.txt".

 Stream sm=   assem.GetManifestResourceStream("hex.Resource1.resources");
         if (sm != null)
         {


             StreamReader sr = new StreamReader(sm);
             string ret = sr.ReadToEnd();
             Console.Write(ret);
         }
         else
         {
             Console.Write("sm is null");
         }
         就可以成功了
:\code\test\hex\hex>E:\code\test\hex\hex\bin\x64\Debug\hex.exe
???   ?   lSystem.Resources.ResourceReader, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089#System.Resources.RuntimeResourceSet          PADPADPa??    ?   S t r i n g 1     aaa

相关推荐

  1. GetManifestResourceStream

    2024-04-23 16:00:03       27 阅读
  2. new Promise

    2024-04-23 16:00:03       48 阅读
  3. qt 定时器

    2024-04-23 16:00:03       59 阅读
  4. fmt

    2024-04-23 16:00:03       57 阅读
  5. not exists

    2024-04-23 16:00:03       58 阅读
  6. 详解WebMvcConfigurer

    2024-04-23 16:00:03       41 阅读
  7. Tinyxml基本

    2024-04-23 16:00:03       62 阅读
  8. man

    2024-04-23 16:00:03       57 阅读
  9. mybatisPlus 常见

    2024-04-23 16:00:03       46 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-23 16:00:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-23 16:00:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-23 16:00:03       87 阅读
  4. Python语言-面向对象

    2024-04-23 16:00:03       96 阅读

热门阅读

  1. MySQL数据库——18、事务

    2024-04-23 16:00:03       29 阅读
  2. AtomGit 体验

    2024-04-23 16:00:03       36 阅读
  3. Stable Diffusion 本地部署教程

    2024-04-23 16:00:03       32 阅读
  4. PySide6之QEasingCurve.Type

    2024-04-23 16:00:03       31 阅读
  5. Swift常用的第三方库

    2024-04-23 16:00:03       39 阅读
  6. 工作后的自我介绍

    2024-04-23 16:00:03       30 阅读
  7. ATFX:注册邀请码怎么弄?

    2024-04-23 16:00:03       33 阅读
  8. 大数据——Scala 模式匹配

    2024-04-23 16:00:03       28 阅读
  9. 第4章:GO的错误处理机制

    2024-04-23 16:00:03       31 阅读
  10. 在 C 中打印字符串 - 如何在 C 中打印字符串

    2024-04-23 16:00:03       37 阅读