왜 Enumerable.Range
이 IDisposable
을 구현하는지 궁금합니다.Enumerable.Range IDisposable을 구현하는 이유는 무엇입니까?
나는 IEnumerator<T>
이 왜 그런지 이해하지만, IEnumerable<T>
은 필요하지 않습니다.
는 (I, 나는 호기심 중에 중단 점을 배치했다 그것의 "소스 완료"방법
if (enumerable is IDisposable)
((IDisposable)enumerable).Dispose();
같은 문이 내 .Memoise() 구현을 가지고 노는 동안이 발견 테스트에 의해 트리거되었습니다.)
http://csharpindepth.com/articles/chapter6/iteratorblockimplementation.aspx –