I know two methods to get string from resource files.
Method 1: Directly access.
string str = _NAMESPACE.Properties.Resources.HelloWorld;
Method 2: Via ResourceManager.
ResourceManager rm = new ResourceManager("_NAMESPACE.Properties.Resources", Assembly.GetExecutingAssembly());
string str = rm.GetString("HelloWorld");
If there are multiple localizing resources files, both these two methods would get correct localizing string.
If I made a typing mistake in string key, method1 would fail while building. Method2 will fail until run time. For this reason, I think method1 is better than method2.
I found some similar questions in this forum. However, I still can't get good answer for my question.
Why is it better to call the ResourceManager class as opposed to loading resources directly by name?
Is method1 really better?