I’m working with C# and in some methods I use several lists for database results. These can be quite large (10 lists of about 1,000 objects each).
For the moment, I just return from these methods and let the garbage collector clear it. If just before returning I write TheList.Clear(); is this going to be of any benefit?
Thanks.
Since calling
Clearon the list doesn’t cause garbage collection on the data, but only removes the reference from the list to the objects, it won’t give any benefit.