public class IntSingular: IntSequence{
private int it;
public IntSingular(int it){
this.it = it;
}
public override int Min{
get {return it;}
}
public override int Max{
get {return it;}
}
public override IEnumerator GetEnumerator (){
return new SingularEnumerator(this);
}
private class SingularEnumerator: IEnumerator{
private readonly IntSingular ints;
private int idx;
public SingularEnumerator (IntSingular ints){
this.ints = ints;
idx = -1; // position enumerator outside range
}
public Object Current{
get {return ints.it;}
}
public bool MoveNext (){
if (idx == -1)
{idx++; return true;}
else
{return false;}
}
public void Reset(){
idx = -1;
}
}
} |