Using resources in C# and Visual Studio 2008
I've recently found the resx
resources feature of C#/VS2008. However, I have trouble finding information about what they are normally used for.
For example, I want to have a "static string" 开发者_开发知识库defined somewhere in my project, such as a CSS class that should be used in certain circumstances. Is it a good idea to define that string as a resource for my project? Or should I just define a class with a bunch of const string
for these purposes?
Resource files should generally be used for strings that need internationalisation (user interface messages typically).
Where you have strings like file paths and such like that need to be changeable without re-compiling the application these should go in the app configuration files.
Where you have genuine constants (such as your example looks like) these should be defined as const strings in the code.
精彩评论