Friday, December 16, 2005

What is .Resx file in Dot Net?

What is .Resx file in Dot Net??

It is an XML based file, with key value pair.

Reading from .Resx File:

You can access the .Resx file using this code:

ResXResourceReader reader = new ResXResourceReader(Server.MapPath("test.resx"));
IDictionaryEnumerator rsxr = reader.GetEnumerator();
foreach (DictionaryEntry d in reader)
{
Console.WriteLine(d.Key.ToString() + ":\t" + d.Value.ToString());
}
//Close the reader.
reader.Close();

Writing to .Resx File:

We can write the binary data of an image to the .Resx file using the following code

Image img = Image.FromFile("urdu.jpg");
ResXResourceWriter rsxw = new ResXResourceWriter("urdu.resx");
rsxw.AddResource("urdu.jpg",img);
rsxw.Close();

Use of .Resx File:

It is very useful while working on Localized project [Multiple Languages], You can make different resource files for different languages and depending upon the user choice you can change the Language of the application.

5 comments:

Anonymous said...

Good design!
[url=http://pjdaulnd.com/xemk/abdc.html]My homepage[/url] | [url=http://zmfrwbwx.com/jgkm/rnjv.html]Cool site[/url]

Anonymous said...

Nice site!
My homepage | Please visit

Anonymous said...

Good design!
http://pjdaulnd.com/xemk/abdc.html | http://rsguxgrj.com/skkg/ikws.html

Anonymous said...

Nice site!
[url=http://zvstbwvf.com/zhwm/ryiq.html]My homepage[/url] | [url=http://icoyodjl.com/bqbk/esdg.html]Cool site[/url]

Anonymous said...

Great work!
http://zvstbwvf.com/zhwm/ryiq.html | http://nnqtflsc.com/nrfg/talv.html