Does it throw an exception on the FIRST loop?
If you take out that <= and just make it <, does that solve the problem (as it would be looping 1 too many times)?
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
league is defined as an array of Club[], but you never actually create any club objects and store them in league, so when you try to use it in like 15, there is nothing there to use.
Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
if
Club[] league = new Club[10];
,
then
foreach(Club c in league)
{
//add mandatory players here
}
BUT THAT DEPENDS on how a Club object is created.
If a club has a player array or list that is automatically created, then you're OK.
My syspicion is that the player array in the club is not yet allocated.
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402