Search code examples
asp.netresourceslocalizationresx

How to write all three values using the resxresourcewriter?


http://msdn.microsoft.com/en-us/library/system.resources.resxresourcewriter.aspx

In this link and others like it, I see code to write in the "name" and "value" but not the "comment". I use the comment field heavily. Is there code for accessing all 3 simultaneously or the comment field individually? Or do I have to manipulate the XML directly?


Solution

  • Apparently you can set the comment on a ResXDataNode object. You can then write the ResXDataNode with the ResXResourceWriter.AddResource(ResXDataNode) method.

    resxWriter.AddResource(new ResXDataNode("key", "value") { Comment="comment" });
    

    Source: http://www.codeproject.com/KB/dotnet/ResxSync.aspx?msg=1708100 (after the main article, comment "Comments ARE accesible [modified]")