Skip to content

Instantly share code, notes, and snippets.

@spoo-bar
Last active May 9, 2019 12:24
Show Gist options
  • Save spoo-bar/04c6d74e8e26679174efc3c047401c11 to your computer and use it in GitHub Desktop.
Save spoo-bar/04c6d74e8e26679174efc3c047401c11 to your computer and use it in GitHub Desktop.
Updating the resource files programatically
using System.Resources;
var resxFilePath = @".\XyzResources.fr.resx";
var resourceKey = "greetingText";
var resourceString = "Bonjour";
if (File.Exists(resxFilePath))
{
using (var resourceWriter = new ResXResourceWriter(resxFilePath))
{
resourceWriter.AddResource(resourceKey, resourceString);
resourceWriter.Generate();
resourceWriter.Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment