Remove item from dictionary where value is empty list

.net-3.5, c#, dictionary

Solution

var foo = dictionary
    .Where(f => f.Value.Count > 0)
    .ToDictionary(x => x.Key, x => x.Value);

This will create a new dictionary. If you want to remove in-place, Jon's answer will do the trick.

Problem

What is the best way to remove item from dictionary where the value is an empty list? ``` IDictionary<int,Ilist<T>> ```

Original source