views:

145

answers:

1

Before .NET 3.5 was released, I use

Dictionary<TKey, List<TValue>> 

for containing data. But I just found that .NET 3.5 provides new collection type that is ILookup class that can represent my old complex data type.

I always create ILookup object by using LINQ extension method (ToLookup method). But I do not know how to modify ILookup object.

Is it possible? Or I need to create by using union method and call ToLookup method again.

Thanks,

+1  A: 

You don't, it's immutable. You have listed both of the reasonable options; either to use a dictionary of sub-collections or to keep creating new lookups.

mquander