public class Intstrot : IEnumerator,IEnumerable
{
int[] a;
int CurrentIndex = -1;
int EndIndex = -1;
int containAblity;
public Intstrot(int ContainAblity)
{
containAblity = ContainAblity;
a = new int[containAblity];
}
public object Current
{
get {
if (CurrentIndex > a.Length | CurrentIndex < 0)
throw new Exception();
return a[CurrentIndex];
}
}
public bool MoveNext()
{
return ++CurrentIndex < a.Length;
}
public void Reset()
{
CurrentIndex = -1;
}
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
public int Add(int value)
{
a[++EndIndex] = value;
return EndIndex;
}
}