1
using System
.Collections
.Generic
;
3 namespace IEnumerableExtras
6 /// Provides <see cref="IEnumerable{T}"/> with Flatten extension method.
8 public static class EnumerableFlatten
11 /// Flatten two-tier collection into one-tier collection.
13 /// <typeparam name="T"></typeparam>
14 /// <param name="collection"></param>
15 /// <returns></returns>
16 public static IEnumerable
<T
> Flatten
< T
>( this IEnumerable
<IEnumerable
<T
>> collection
)
18 foreach ( var enumerable
in collection
)
20 if ( enumerable
!= null )
22 foreach ( var item
in enumerable
)