C# ResourceManager

More frustration with localization…

ResourceManager is .net’s way of loading resources (images, text, xml) to use in your assembly. I’m using RM as a way to load different language resource bundles into my class based on the cultureinfo.

Create a resource file using the “Resource File” template from the solution explorer. This creates a *.resx file. Add in your key value pairs into your resource file. To access your values in your resource file, create an instance of the ResourceManager with the CORRECT resource file and assembly as follows.

ResourceManager rm = new ResourceManager(“YourNamespace.YourResouceFile”, Assembly.GetExcecutingAssembly());

rm.GetString(“YourKey”);

Sigh. The part I got tripped up on was the “YourNamespace” of the resource file. Apparently you need the fully qualified name of the resource file you’re trying to load otherwise .net doesn’t know where to find the file. There’s probably a different way of doing it, but that’s what I’m going with for now….

@#(*$)(@*#!@*&#!@(*#

This entry was posted in Programming. Bookmark the permalink.

One Response to C# ResourceManager

  1. Peter says:

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>