Declare a Dictionary inside a static class
Posted
by Ngu Soon Hui
on Stack Overflow
See other posts from Stack Overflow
or by Ngu Soon Hui
Published on 2008-11-24T03:07:59Z
Indexed on
2010/05/25
17:21 UTC
Read the original article
Hit count: 170
How to declare a static dictionary object inside a static class? I tried
public static class ErrorCode
{
public const IDictionary<string , string > ErrorCodeDic
=new Dictionary<string, string>()
{
{"1","User name or password problem"}
};
}
But the compiler complains that "A const field of a reference type other than string can only be initialized with null".
© Stack Overflow or respective owner