[Mono-devel-list] Basic C# help
Everaldo Canuto
everaldo_canuto at yahoo.com.br
Fri Dec 10 16:44:46 EST 2004
Eric,
What is "revenue" declaration? Probably is an array and you a "user"
valeu out of range.
Everaldo.
Em Sex, 2004-12-10 às 15:21 -0600, Eric Scott escreveu:
> Hey;
> I'm newbie to C#, and have been getting an error in some simple code I'm
> doing. The error is right after the following while loop executes:
>
> int totalrevenue = 0;
> user = 0;
> while(user <= revenue.GetLength(0)) {
> user ++;
> totalrevenue += revenue[user];
> }
>
> Compiles fine, but when I run the exe file I get:
>
> Unhandled Exception: System.IndexOutOfRangeException: Array index is out
> of range.
> in <0x00255> Test:Main (string[])
>
> I've fiddled a bit and found that all 50 cycles of the loop execute fine
> (The revenue array is 50 values long in one dimension), but before the
> next segment of the code executes (Just some Console.WriteLine
> commands), the exception occurs.
>
> Sorry to post a newbie question here, but it seemed like the most
> fitting place.
> Cheerio,
> ES
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list