I have an abstract class and would like to add a static dictionary for error codes. I tried the following:
public abstract class Base
{
...
protected static readonly Dictionary<int, string> errorDescriptions = new Dictionary<int, string>()
{
{ 1, "Description1"},
{ 2, "Description2"},
...
};
...
}
but then discovered that this was implemented in .NET 3.0; I am using 2.0. I looked around and some others suggested I add the pairs in the constructor but this is an abstract class.
How can/should I populate the dictionary?
Thanks.
1 Answer