你可以使用ResourceWriter 来完成这个任务
这是来自 MSDN 的示例代码
using System;
using System.Resources;
public class WriteResources {
public static void Main(string[] args) {
// Creates a resource writer.
IResourceWriter writer = new ResourceWriter("myResources.resources");
// Adds resources to the resource writer.
writer.AddResource("String 1", "First String");
writer.AddResource("String 2", "Second String");
writer.AddResource("String 3", "Third String");
// Writes the resources to the file or stream, and closes it.
writer.Close();
}
}
下面会将xml写入资源文件ProjXML.resources
using (ResourceWriter rw = new ResourceWriter(@".\ProjXML.resources"))
{
rw.AddResource("MyXML", xmlDoc.OuterXml);
}