How does one Dispose an object that is set in foreach?
Posted
by Greg Ogle
on Stack Overflow
See other posts from Stack Overflow
or by Greg Ogle
Published on 2010-04-19T20:33:15Z
Indexed on
2010/04/19
20:43 UTC
Read the original article
Hit count: 198
best-practice
|idisposable
foreach(var someDisposableObject in listOfDisposableObjects)
{
//some code
someDisposableObject.Dispose(); //current code contains something like this.
}
Is there safe way, like a using
clause to use in this scenario?
© Stack Overflow or respective owner