This is a question regarding best coding techniques. I would like to know the consensus on how to best avoid strings and hardcoding values in a .NET application. What I have seen so far, where I previously worked:
- Using .resx Resources
- storing these values and lines in App.config or web.config
creating a static ApplicationStrings class and declaring all strings and values there:
public static class ApplicationStrings
{
#region constants
public const string APPLICATION_NAME = "X";
public const string APPLICATION_RESOURCEMANAGER_NAME = "ResourceManagerX";
public const string APPLICATION_DEFAULT_LOGFILENAME = "log.txt";
}
However, this is not the third way, just another hard code? Does it make sense to have such a class? The benefit would be that all lines are in one place, but does that really exclude hardcode?
Also, if you have developed other habits for this situation, feel free to post.