I don't understand how to loop over a static dictionary contained in a static class from my aspx page. I have this for the static class
public static class ErrorCode
{
public static IDictionary<int, string> ErrorCodeDic;
static ErrorCode()
{
ErrorCodeDic = new Dictionary<int, string>()
{
{1, "a problem"},
{2, "b problem"}
};
}
}
MORE SPECIFIC I can get it to work by spelling it out like this in the aspx part
foreach( System.Collections.generic.KeyValuePair<int, string> kvp in MyLibrary.Dictionaries.ErrorCode.ErrorCodeDic)
But I thought I could shorthand it by declaring variables in the code behind?
Public KeyValuePair<int, string> error;
Public ErrorCode.ErrorCodeDic ErrorCodes; OR
Public ErrorCode.ErrorCodeDic ErrorCodes = ErrorCode.ErrorCodeDic; "
I get build errors "The type name 'ErrorCodeDic' does not exist in the type ErrorCode.
And then in the aspx page use
foreach( error in ErrorCodes)