一意のサブジェクト値がそれに一致する必要があるさまざまなコード値を持つ辞書を作成しようとしています。
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
したがって、私が望むのは、要件と選択が一意のキーとして一度辞書に追加され、次に対応するすべてのコードがリストに追加されることだけです。これを行うにはどうすればよいですか?
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);