I have a
List<MyObject>
that I retrieve from the database. However, I would like it keyed by a property in MyObject for grouping purposes. What is the best way with LINQ to cast my list to:
Dictionary<long, List<MyObject>>
I have the following:
myObjectList.ToDictionary(x => x.KeyedProperty)
But it returns:
Dictionary<long, MyObject>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…