我正在尝试填充一个字典,其中唯一的主题值具有应该与之匹配的各种代码值。
CODE SUBJECT
7DIM-062 Recruitment and Selection
7DIM-063 Recruitment and Selection
7DIM-064 Recruitment and Selection
7DIM-065 Recruitment and Selection
7DIM-066 Recruitment and Selection
7DIM-067 Recruitment and Selection
7DIM-068 Recruitment and Selection
所以我想要的只是将 Reqruitment 和 Selection 作为唯一键添加到 Dictionary 中,然后将所有相应的代码添加到 List 中。我该怎么做呢?
Dictionary<string, List<string>> dict = new Dictionary<string,List<string>>();
这是我的查询
OleDbDataReader dbReader = cmd.ExecuteReader();
while (dbReader.Read())
{
string code = (string)dbReader["CODE"];
string subject = (string)dbReader["SUBJECT"];
//???? this is the point where I would want to add the values
dict.Add(subject, new List<string>().Add(code);