Unified iterators for all enumerables

Can we please get a way to iterate arrays, IEnumerables, and lists in the same way?

For Arrays, we have a static (non-extension) method on Array, ForEach. For List<T>, we have an instance method ForEach. For IEnumerable, we don't have any way.

Can anyone explain the design or idea here?

-Michael

[335 byte] By [Michael_Giagnocavo] at [2008-1-8]
# 1
Agreed. Having to define an extension method or use ToList() every time you want to iterate over an IEnumerable is somewhat annoying.
FalconNL2007 at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Visual C# Orcas...
# 2

Good suggestion, can you enter it in Connect?

Thanks!

Marcelo.

MarceloGuerra-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Visual C# Orcas...

Visual Studio Orcas

Site Classified