Open
Description
Frédéric Delaporte created an issue — 20th June 2017, 19:59:11:
In most cases, interfaces still exposing non generic enumerable such as
IEnumerable
,ICollection
,IList
,IDictionary
are remnants of .Net Framework 1.1.It is about time to move them to generic interfaces, at worst
IEnumerable<object>
for cases where it proves unpractical to introduce a generic type parameter.The main drawbacks of keeping usages of non-generic enumerable are:
- Their
IEnumerator
are not disposable, though most of the time the underlying implementation will be. This constrains to try cast toIDisposable
them for ensuring disposing any underlying disposable.- They have far less extension methods for Linq manipulation, regularly causing code like
.Cast<object>()
to be used on them for converting them toIEnumerable<object>
.- We maintain some custom
EnumerableExtensions
,CollectionHelper
,ArrayHelper
,CollectionPrinter
,EnumeratorAdapter
only for them.