Save and read value from resx resource file
using System;
using System.Resources;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Resources;
class ResourceGenerator
{
static void Main(string[] args)
{
ResXResourceWriter w = new ResXResourceWriter("ResXForm.resx");
Image i = new Bitmap("winter.jpg");
w.AddResource("myImage", i);
w.AddResource("welcomeString", "www.java2s.com");
w.Generate();
w.Close();
// Make a resx reader.
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();
}
}
Related examples in the same category