WPF中Resx文件中添加Byte[]
static void Main(string[] args)
{
using(ResXResourceWriter resWriter=new ResXResourceWriter(@"F:\xxxx\xxx\MyResource.resx"))
{
byte[] secBytes = File.ReadAllBytes(@"F:\xxx\MyResources\rhlsl.xxx");
resWriter.AddResource("rhsl", secBytes);
resWriter.Generate();
}
Console.Write("xxx");
}
然后再打开MyResource.resx
:
那么,现在可以直接用MyResources.rhsl
来得到byte[],(前提是有MyResource.Designer.cs
)
从而
MemoryStream stream = new MemoryStream(Resources.rhsl);
StreamReader sr = new StreamReader(stream, Encoding.UTF8);
string result= sr.ReadToEnd();
就可以得到result。
#####
愿你一寸一寸地攻城略地,一点一点地焕然一新
#####