Create a Resx resource file : Resx « GUI Windows Forms « C# / CSharp Tutorial





using System;
using System.Collections;
using System.IO;
using System.Resources;

class MainClass
{
    static void Main(string[] args)
    {
        string resXFile = "test.resx";
        string resKey = "myKey";
        string resValueFile = "myValue";

        using (ResXResourceWriter writer = new ResXResourceWriter(resXFile))
        {
            Console.WriteLine("Associating {0} with {1}'s contents", resKey, resValueFile);
            Console.Write("To {0}...", resXFile);

            using (ResXResourceReader reader = new ResXResourceReader(resXFile))
            {
                foreach (DictionaryEntry node in reader)
                    writer.AddResource((string)node.Key, node.Value);
            }

            writer.AddResource(resKey, File.ReadAllBytes(resValueFile));
        }
    }
}










23.73.Resx
23.73.1.Create a Resx resource file
23.73.2.Make a resx writer and specify the file to write to
23.73.3.ResXResourceWriter and ResXResourceReader