Quantcast
Channel: Programming (In-game)
Viewing all articles
Browse latest Browse all 903

Index was out of range

$
0
0
Hi,

I am having issues with some code, it compiles but when I run it I get an error message saying:

"Caught exception during execution of
script: Index was out of range. Must be
non-negative and less then the size of the
collection.
Parameter name: index"

Code is as follows:
Code:
void Main(string argument)
{
  //Variables
  int numOfSolarPanels = 4;

  //Create List
  List<IMyTerminalBlock> solarPanels = new List<IMyTerminalBlock>(numOfSolarPanels);

  //Populate List
  for...
Index was out of range

Viewing all articles
Browse latest Browse all 903

Trending Articles