Hello, Is it possible to enumerate a collection while still adding new items to it? One of my applications needs to populate a collection, then I need to walk through this collection possibly adding new items to the collection until no new items are found. (I am certain this will not enter an infinite loop). Is this possible? Is there a better way to approach this?
Thanks, Scott Here is a quick (and very dirty example) of what I would like to do? private ArrayList al = new ArrayList(); int i = 0; private void Page_Load(object sender, System.EventArgs e) { al.Add(i.ToString()); i++; al.Add(i.ToString()); foreach(string s in al) { AddItem(); Response.Write(s + "<br>"); } } private void AddItem() { if(i < 5) { i++; al.Add(i.ToString()); } } You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.