|
-
Nov 15th, 2008, 06:29 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [3.0/LINQ] List<> Clear() method
I have a generic List<> that I am adding instances of a class to like this:
Code:
myList.Add(new myClass());
At such time I wish to clear the list, I call the Clear() method and it removes the items in the List<>, but I am a bit unsure of how memory is affected at this point.
MSDN says of the Clear() method:
Count is set to 0, and references to other objects from elements of the collection are also released.
I am taking this to mean that apart from clearing the list, the instances of the classes added to the list are destroyed, and will now be garbage collected.
Am I right?
(The class does not contain anything that needs Dispose() calling on it, it is all managed types and code.)
Thanks to anyone that can cure my crisis of confidence!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|