Search code examples
.neterror-handlingcoding-style

What is the best approach to centralzing error messages in an application?


All throughout an application wherever error messages (or other user messages) are used I typically hard-code a string. Obviosly this can be really bad (especially when you may have to come back and localize an app). What is the best approach to centralize these strings? A static class? Constants? An XML File? Or a combination (like creating a static class with constants that are used to read from an xml file).


Solution

  • Create the strings in a resource file. You can then localise by adding additional resource files.

    Check out http://geekswithblogs.net/dotNETPlayground/archive/2007/11/09/116726.aspx