Currently I access my resource .resx file like this:
ResourceManager manager = new ResourceManager("Resources.Messages", Assembly.Load("App_GlobalResources"));
string test = manager.GetString("EmailBodyMagazine", System.Globalization.CultureInfo.CurrentCulture);
I'm trying to create a static class MessageResource that accesses the resource file so that to call this class from an开发者_StackOverflowy code all I need to do is this:
string test = MessageResource.EmailBodyMagazine
How can I achieve this?
Open the .resx file using VS2008. From the .resx editor toolbar change the 'Access Modifier' to 'Public'. This will allow access to the resources from any asssembly that references the App_GlobalResources assembly (ex: Messages.EmailBodyMagazine).
You can also find a quick tutorial here.
精彩评论