Is there a way to get an IEnumerable<T>
from an IEnumerable
without reflection, assuming I know the type at design time?
I have this
foreach(DirectoryEntry child in de.Children)
{
// long running code on each child object
}
I am trying to enable parallelization, like so
Parallel.ForEach(de.Children,
(DirectoryEntry child) => { // long running code on each child });
but this doesn't work, as de.Children is of type DirectoryEntries
. It implements IEnumerable
but not IEnumerable<DirectoryEntry>
.