Why use IDictionary for Child Classes for NHibernate?
As I read here http://www.theserverside.net/tt/articles/showarticle.tss?id=NHibernate
for example
public class Department
{
private int id;
private string name;
private IDictionary开发者_开发技巧 classes;
private IDictionary professors;
}
Why not use Generic List ?
Dictionaries are more efficient when performing that kind of lookup. Lists are great but if you're dealing with pairs of values (such as class ID/name, professor ID/person ID) dictionary lookups will be faster. Dictionaries also offer additional functionality, e.g. finding out if an element exists. With a list you'd have to loop through the entire thing (slower and more code) while dictionaries are indexed for you.
Hope that helps
精彩评论