ResXResourceWriter and ResXResourceReader : Resx : GUI Windows Forms C# Examples


C# Examples » GUI Windows Forms » Resx »

 

ResXResourceWriter and ResXResourceReader









    
using  System;

using  System.Resources;

using  System.Drawing;
using  System.Collections;
using  System.Windows.Forms;

public  class  MainClass{
    public  static  void  Main(){
        
        ResXResourceWriter  w  =  new  ResXResourceWriter("ResXForm.resx");
            
        Image  i  =  new  Bitmap("YourFile.bmp");
        w.AddResource("happyDude",  i);
        
        w.AddResource("welcomeString",  "Hello  new  resource  format!");
            
        w.Generate();
        w.Close();
            
        ResXResourceReader  r  =  new  ResXResourceReader("ResXForm.resx");
        
        IDictionaryEnumerator  en  =  r.GetEnumerator();
        while  (en.MoveNext())  
        {
            Console.WriteLine("Value:"  +  en.Value.ToString()  +  "  Key:  "  +  en.Key.ToString());
        }
        r.Close();
      }
}
    
   
  
   



Output

Value:System.Drawing.Bitmap Key: happyDude
Value:Hello new resource format! Key: welcomeString


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo GUI Windows Forms
» Resx