vs.net2005下集合类支持Generics的简单实现
仅仅是一个最简单的实现,其中很多处理方法方面code还需要加入
public partial class MyEnum<T>
{
private int _index = -1;
private T[] _items = new T[20];
public MyEnum()
{
}
}
public partial class MyEnum<T> : IEnumerable<T>
{
public IEnumerator<T> GetEnumerator()
{
for (int i = _index; i >= 0; i--)
{
yield return _items[i];
}
}
}
{
private int _index = -1;
private T[] _items = new T[20];
public MyEnum()
{
}
}
public partial class MyEnum<T> : IEnumerable<T>
{
public IEnumerator<T> GetEnumerator()
{
for (int i = _index; i >= 0; i--)
{
yield return _items[i];
}
}
}