c# Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Foxy
    New Member
    • Nov 2006
    • 2

    c# Help

    Hi guys,
    Sorry to interrupt, but I need your help

    I can't seem to make this error go away:

    QuorumTest.Quor umTest.NoQuorum : System.Argument OutOfRangeExcep tion : Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    Below is a snippet of the code that is producing the error
    Ps: this error only occurs at runtime using NUnit
    for (int a = 0; a < x.Count; a +=2)
    {
    int current = x[a];
    int next = x[a + 1];
    int nextB = x[a + 2];
  • sivadhas2006
    New Member
    • Nov 2006
    • 142

    #2
    Hi,

    Try this.
    Code:
    int
       nArrayLength = x.Count;
     
    for (int a = 0; a+2 < nArrayLength; a +=2)
    Regards,
    M.Sivadhas.

    Comment

    Working...