in this way I am adding a new record.

Error:

ResX file Data at the root level is invalid. Line 1, position 1. cannot be parsed.

ResourceWriter ren = new ResourceWriter(path);
DataContextDataContext db = new DataContextDataContext();
var result = db.MultiLanguages;
foreach (var item in result.ToList())
{
    ren.AddResource(item.key, item.en);
}
ren.Dispose();
ren.Close();

error message

1 Answers

0
user10103607 On

Try to add an encoding property in your resx file, at line no. 1:

<?xml version="1.0" encoding="ISO-8859-1"?>

Also, use the using block to create the ResourceWriter instance. Something like this:

using(ResourceWriter ren = new ResourceWriter(path))
{
    DataContextDataContext db = new DataContextDataContext();
    var result = db.MultiLanguages;
    foreach (var item in result.ToList())
    {
        ren.AddResource(item.key, item.en);
    }
}