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>