Joh*_*ann 4 c# dictionary
对于一对一,我可以使用哈希或字典.例如,史密斯是26岁,布朗是35岁.这很清楚.一对多怎么样?例如,Smith参加class01,class08,class12,Brown参加class01,class05和class08.我有什么选择,什么是最佳选择?
Ree*_*sey 9
您仍然可以使用a Dictionary,但您需要将值类型设为集合,即:Dictionary<Person, IList<Class>>.这将允许您存储每人的班级列表.
Dictionary
Dictionary<Person, IList<Class>>
归档时间:
13 年,8 月 前
查看次数:
1047 次
最近记录: