First post. I am trying to put a large range of numbers into an array (-1000 to 1000) and then do an exponential search. I have very little experience with c# and getting stuck on how to put such a large range into an array. I've been trying a for loop but got stuck.
int[] rangeArray = new int [2000];
for(int x = -1000; x < 1000; ++x)
{
rangeArray[x + 1000] = x;
}
You can use
Enumerable.Range
for this:The first variable is "start" and the second is "count".
The result is that the first item's value is -1000 and the last item's value is 1000.
Alternative method using a loop: