I\'ve gotta be missing something simple here.
Take the following code:
public IEnumerable getInt(){
for(int i = 0; i < 10; i++){
y
It's important to mention that the duty of the foreach loop is to dispose the enumerator if the instance implements IDisposable. In other words, foreach should be replaced with something like:
var enumerator = enumerable.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
var item = enumerator.Current;
// do stuff
}
}
finally
{
var disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}