DNRTv Episode 3 - Correction

A lot of people have been quick to point out the fact that .Net 1.1 does not have generics, even though I forgot to mention that fact also. In response to this, here is how you can implement the ListEnumerable in a pre 2.0 environment:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class ListEnumerable : IEnumerable
{
    private IList itemsToEnumerate;


    public ListEnumerable(IList itemsToEnumerate)
    {
        this.itemsToEnumerate = itemsToEnumerate;
    }

    public IEnumerator GetEnumerator()
    {
        return itemsToEnumerate.GetEnumerator();
    }

}

I hope that clears that up!!

Comments