Search code examples
c#foreachunity-containerconcurrentdictionary

Where did ConcurrentDictionary.ForEach go?


Context: C#, VS, Unity

We updated Unity from 4.0.1 to 5.11.3. Now the ForEach-method on a ConcurrentDictionary is no longer found.

I suspect I'm missing an other Nuget-package or that it just changed namespace - I have googled but still can't find any solution.

Does anyone know where it went?

It seems that Microsoft.Practices.ObjectBuilder2 disappeard with the newer Unity, but to where?


Solution

  • I ended up writing an extension.

    public static void ForEach<T>(this IEnumerable<T> list, Action<T> action)
    {
        foreach (var item in list)
        {
            action(item);
        }
    }