By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 1,990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

Issues with System.Collections.Generic.List

P: n/a
I have an issue with the System.Collections.Generic.List that I can't
find anywhere else...

My website suddenly starts giving off System.IndexOutOfRangeException:
Index was outside the bounds of the array. errors in a spot that I
cannot figure out the problem. It will work all day, then suddenly
start giving off the error, which makes quite a bit fail.

The error (System.IndexOutOfRangeException: Index was outside the
bounds of the array. ) occurs on line 14, which makes absolutely no
sense. Any ideas? Like I said, it will work all day, then just start
failing for what looks like no reason... Thanks

My code:
1 Public Enum ImageSize
2 Small = 10
3 Medium = 20
4 Thumbnail = 30
5 Zoom = 40
6 Large = 50
7 End Enum
8
9 Private Shared _imageSizes As List(Of ImageSize) = Nothing
10 Private Shared Function GetImageSizes() As List(Of ImageSize)
11
12 If _imageSizes Is Nothing Then
13 _imageSizes = New List(Of ImageSize)
14 _imageSizes.Add(ImageSize.Small)
15 _imageSizes.Add(ImageSize.Medium)
16 _imageSizes.Add(ImageSize.Thumbnail)
17 _imageSizes.Add(ImageSize.Zoom)
18 _imageSizes.Add(ImageSize.Large)
19 End If
20
21 Return _imageSizes
22 End Function

Oct 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.