我有以下代码:
List<Dictionary<string, string>> allMonthsList = new List<Dictionary<string, string>>();
while (getAllMonthsReader.Read()) {
Dictionary<string, string> month = new Dictionary<string, string>();
month.Add(getAllMonthsReader["year"].ToString(),
getAllMonthsReader["month"].ToString());
allMonthsList.Add(month);
}
getAllMonthsReader.Close();
现在我正在尝试遍历所有月份,如下所示:
foreach (Dictionary<string, string> allMonths in allMonthsList)
我该如何访问关键值?我做错了什么吗?
allMnths
来自哪里? - John Isaiah CarmonaToString()
但没有成功。 - eric.itzhak