This project has moved. For the latest updates, please go here.

IEnumerable<Lazy<T>> is not very readable

Jul 17, 2009 at 5:38 AM

As Krzysztof Cwalina mentions in his book "Framework Design Guidelines"

generics type should not contain other generics type within the brackets


I suggest inheritance

public class LazyEnumerable<T>: IEnumerable<Lazy<T>>

Jul 17, 2009 at 6:00 AM

Thanks Bnaya

You can avoid this syntax by using arrays which we support, thus you can have Lazy<T>[]. We also support derived types, so you can create a collection similar to our previous ExportCollection<T,M> which derives from IEnumerable<Lazy<T,M>>.

The reason we pulled ExportCollection<T,M> is several fold, 1. It was pure syntactic sugar, 2. LazyCollection or LazyEnumerable implies by the name there is something special about the collection i.e. implying the collection itself is lazy which is not true. Such an implication might lead one to improper usage of the collection. IEnumerable<Lazy<T>> or Lazy<T>[] are both clearly indicate that the collection itself is not special.