Create a Resx resource file : Resx : GUI Windows Forms C# Examples


C# Examples » GUI Windows Forms » Resx »

 

Create a Resx resource file









    
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));
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo GUI Windows Forms
» Resx