c# - Error: Index was outside the bounds of the array -


when i'm running code, i'm getting error

index outside bounds of array.

for (var = 9; + 2 < lines.length; += 3)         {             items.add(new itemproperties {                  item = lines[i],                 description = lines[i + 1],                 quantity = lines[i + 2],                 unitprice = lines[i + 3]              });         } 

can me out, please?

you're using lines[i + 3] in loop, check ensures i + 2 in range - , fact you're using 4 values in loop rather 4 makes should be:

for (var = 12; + 3 < lines.length; += 4) {     items.add(new itemproperties {          item = lines[i],         description = lines[i + 1],         quantity = lines[i + 2],         unitprice = lines[i + 3]     }); } 

(that's assuming want start on 4th item, before - should check want initial value of i be.)


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -