Anonymous
Anonymous

Reputation: 9648

Best way to define error code and error message mapping in .NET

I want to create custom error code and message mapping file. Currently I use Dictionary<int, string> to store them but I think they may have better way to achieve this.

If there is common practice to do this please let me know.

Upvotes: 0

Views: 1051

Answers (2)

Jaime
Jaime

Reputation: 6814

You could define an enum for your error codes that map to a resource file, that way they can be esaly manage, localized, etc.

Upvotes: 0

Adriaan Stander
Adriaan Stander

Reputation: 166396

Maybe rather have a look at using a resource in the project

Adding and Editing Resources (Visual C#)

Upvotes: 1

Related Questions