|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MatchingSample
{
public class ArrayEnumerator<T> : IEnumerator<T>
{
private T[] array;
private int index = -1;
private int maxIndex;
public ArrayEnumerator(T[] array)
{
this.array = array;
this.maxIndex = this.array.Length - 1;
}
public T Current
{
get { return array[index]; }
}
object System.Collections.IEnumerator.Current
{
get { return array[index]; }
}
public bool MoveNext()
{
if (index < maxIndex)
{
index++;
return true;
}
else
{
return false;
}
}
public void Reset()
{
index = -1;
}
public void Dispose()
{ }
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.