Last active
May 9, 2019 12:24
-
-
Save spoo-bar/04c6d74e8e26679174efc3c047401c11 to your computer and use it in GitHub Desktop.
Updating the resource files programatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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