简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM