I have a class whose instances should be deleted. I also have several classes that produce these instances, either separately, or lists of them.
Should I return an IList<MyClass> from my methods or should I create a class MyClassCollection that is also one-time and returns this instead?
EDIT:
My main reason for asking that I ended up doing this quite a lot:
IList<MyObject> list = GetList(); foreach(MyObject obj in list) {
and it seems to me that I better do:
using (IList<MyObject> list = GetList()) { foreach(MyObject obj in list) {
Sam holder
source share