In .NET, will cleaning a nested dictionaries parent release all memory upon garbage collection?

Posted by Tomer Pintel on Stack Overflow See other posts from Stack Overflow or by Tomer Pintel
Published on 2010-03-31T12:41:49Z Indexed on 2010/03/31 12:43 UTC
Read the original article Hit count: 212

I have the following nested dictionaries:

  1. Dictionary<int, Dictionary<string, object>> x;
  2. Dictionary<int, SortedDictionary<long, Dictionary<string, object>>> y;

If I do x.Clear() and y.Clear() will all the nested objects clear and all the memory will be reused on the next garbage collection?

Or do I need to iterate on all the items and clear them manually?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET