简体   繁体   English

C#以编程方式创建资源

[英]C# create resources programmatically

I've been researching for a method to add a resource programmatically. 我一直在研究以编程方式添加资源的方法。

Basically I'm reading some values from a memory mapped file. 基本上,我从内存映射文件中读取一些值。 I want to be able to create a resource string to store the values read. 我希望能够创建一个资源字符串来存储读取的值。

For example: 例如:

MemoryMappedFile mmf = MemoryMappedFile.OpenExisting("test");

using (MemoryMappedViewAccessor accessor = mmf.CreateViewAccessor())
{
    Byte[] buffer = new Byte[1024];
    accessor.ReadArray<byte>(0, buffer, 0, buffer.Length);
    String S = Encoding.Default.GetString(buffer);
}

I want to be able to put that string into a resource file 我希望能够将该字符串放入资源文件中

我想到底是存储的,而不是某个文件或数据库中的数据,因为它是唯一的ID ,所以我将它存储在解决它Registrey Keycurrent user ,所以它不会需要任何管理privilieges。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM