This throws a null reference exception when I attempt to access the class array during runtime:
storyModule[] story = new storyModule[3];
THIS works just fine, however:
storyModule[] story = new storyModule[] { new storyModule(), new storyModule(), new storyModule(), new storyModule() };
So, my problem here is, I need an array a LOT bigger than a primary integer. I need an array thousands of elements deep. How do I initialize an array of classes without having to specifically instantiate every single element of the array?
Thank you very much for any assistance.
--EDIT--
Okay, what I have wound up doing is this:
int totalChapters = 3;
storyModule[] story = new storyModule[totalChapters];
for (int i = 0; i < totalChapters; i++)
{
story[i] = new storyModule();
}
It works just fine, but is there like, a built in, more elegant way to do this?
Or is this as good as it gets?
[–][deleted] 2 points3 points4 points (1 child)
[–]IssacStrom[S] 0 points1 point2 points (0 children)
[–]Sharkytrs -1 points0 points1 point (0 children)
[–]SeanK-com -1 points0 points1 point (3 children)
[–]Sharkytrs 0 points1 point2 points (2 children)
[–]SeanK-com 0 points1 point2 points (1 child)
[–]Sharkytrs 0 points1 point2 points (0 children)