I have to programmatically get localized text in an ASP.Net application. The text is there in the resource file of the same assembly. I have written the following code for the same:
1 Assembly a = Assembly.Load("MyAssembly");
2 ResourceManager rm = new ResourceManager("MyAssembly", a);
3 Response.Write(rm.GetString("msg", Thread.CurrentThread.CurrentCulture));
In the first the line of the above code I am explicitly loading the assembly, which is perhaps not an optimal solution. Is there any alternate way to get the localized text without explicitly loading the assembly?