[ACCEPTED]-ResourceManager trying to load .resources not .resx file-resourcemanager
To load .resx into ResourceManager you need 4 specify namespace
var rm = new ResourceManager("Namespace.ResxName", Assembly.GetAssembly());
or you can get ResourceManager 3 for free if set Access Modifier inside Managed 2 Resource Editor to Internal or Public, after 1 that VS will generate ResxName.Designer.cs
var rm = ResxName.ResourceManager;
There's surprisingly simple way of reading 4 resource by string:
ResourceNamespace.ResxFileName.ResourceManager.GetString("ResourceKey")
It's clean and elegant 3 solution for reading resources by keys where 2 "dot notation" cannot be used (for instance 1 when resource key is persisted in the database).
I think the way you are using ResourceManager 7 is wrong. See this post.
Also note, when you 6 open Visual Studio command prompt, & run 5 resgen.exe, it says its used to convert 4 resource files from one format to another 3 (i.e. resx to resources). I think, you will 2 need to convert your file to resources from 1 resx & then load it using resourceManager.
I'm not sure which version of .NET Framework 6 are you using.
Try channging the way how 5 you bring the ResourceManager to life.
ResourceManager rm =
new ResourceManager("Project.Resource",
System.Reflection.Assembly.Load("App_LocalResources"));
It 4 should work.
This is also exposed as a static 3 property of the automatically generated 2 .designer.cs class of the concrete resorce 1 manager.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.