Search code examples
c#resourcesresx

Writing to resx file c#


Trying to write to a Resx file written in xml.

How would i go about adding columns, and rows to it.

List<string> _paths = new List<string> { ConfigurationManager.AppSettings["SpanPath"], ConfigurationManager.AppSettings["FrenPath"], ConfigurationManager.AppSettings["RusPath"] };

        ResourceWriter resourceWriter = new ResourceWriter(_paths.ElementAt(0));

        resourceWriter.AddResource("Key1", "String1");
        resourceWriter.AddResource("Key2", "String2");
        resourceWriter.Close();

I would like to add key1 and have the column beside it on that row to have string1 and so on.

I think I am not understanding how the msdn has explained the way the resource writer should be used.


Solution

  • Got it!

    Had to add reference from the solution explorer. Add reference to System.Windows.Forms.

    Then add System.Resources to top of class file.

    Works now with ResXResourceWriter! :)