All pastes #78958 Raw Edit

Someone

public text v1 · immutable
#78958 ·published 2006-07-04 19:02 UTC
rendered paste body
class test :IEnumerator {

        public ArrayList tests = new ArrayList();
        int position = -1;

        public test() {
        }

        public IEnumerator GetEnumerator() {
                return (IEnumerator)this;
        }

        public bool MoveNext() {
                return(++position<tests.Count);
        }

        public void Reset() {
                position = -1;
        }

        public object Current {
                get { return tests[position];}
        }

};

void Page_Load() {

        test t = new test();

        t.tests.Add("Test 1");
        t.tests.Add("Test 2");
        t.tests.Add("test 3");


        foreach(String st in t)
                Response.Write(st + "<br/>");

        Response.Write("----<br/>");

        foreach(String st in t)
                Response.Write(st + "<br/>");

}