Home > Net >  How to do CRUD operation for .resx file in asp.net core?
How to do CRUD operation for .resx file in asp.net core?

Time:02-05

i want to be able to operate .resx files in the management dashboard

on the internet, i found and tested the codes related to the multilingualization of the site, and now I want to update them in the management panel.

CodePudding user response:

install packege:

ResXResourceReader.NetStandard Version="1.1.0"

use code :

// address Resources.resx
var reader = new ResXResourceReader(filename);
var node = reader.GetEnumerator();
var writer = new ResXResourceWriter(fileName);
while (node.MoveNext())
{
    writer.AddResource(node.Key.ToString(), node.Value.ToString());
}
var newNode = new ResXDataNode(name, value);
writer.AddResource(newNode);
writer.Generate();
writer.Close();
  • Related