1
Reply

Ienumerate, class design help

onez

onez

Feb 10 2005 9:28 PM
2.6k
I have an indexer and can foreach through it but cannot do a nested foreach loop becuase the Current Counts become interchanged for an infinite loop. When should I call Reset? public void Reset() { Cnt = -1; } public bool MoveNext() { return (++Cnt < this.Count); } public object Current { get { return this[Cnt]; } } public IEnumerator GetEnumerator() { Reset(); return (IEnumerator)this; } public void Add(object o) { Datas.Add(o); } Also, I have a objects that are nested like a treeview. I need to be able to easily change a node to another parent, etc. My current objects are indexers and using the arraylist remove, insert is not simple to work with. Looking for a class design suggestion, the main object is a financial statement.

Answers (1)