![]() |
Outofmemoryexception
I am using Arraylist to populate a drop down
I get outofmemoryexception at this line for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++) { sHtml.Append("<option value='" + oYearsList.Add(iYear) + "'>" + oYearsList.Add(iYear) + "</option>"); } When I use: for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++) { sHtml.Append("<option value=2007>2007</option>"); } I dont get this exception. Is there anything wrong the way I am using the Add method of Arraylist. |
Re: Outofmemoryexception
You are adding items to the ArrayList while you loop through the same
arraylist. Sounds like infinite loop to me, right? -- Teemu Keiski AspInsider, ASP.NET MVP http://blogs.aspadvice.com/joteke http://teemukeiski.net <brandonjack007@gmail.com> wrote in message news:1184955893.264471.47110@i38g2000prf.googlegro ups.com... >I am using Arraylist to populate a drop down > > I get outofmemoryexception at this line > for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++) > { > sHtml.Append("<option value='" + oYearsList.Add(iYear) > + "'>" + oYearsList.Add(iYear) + "</option>"); > } > > When I use: > for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++) > { > sHtml.Append("<option value=2007>2007</option>"); > } > > I dont get this exception. Is there anything wrong the way I am using > the Add method of Arraylist. > |
| All times are GMT. The time now is 07:04 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.