This issue is actually from beginning-microsoft-visual-c-2008-isbn-978-0-470-19135-4-400. I have that book and unfortunately the thread is closed there so I want to post my issue here so any others can benefit from a solution. Since this chapter is just the introduction to LINQ I don't think there will be too many differences from the code then (2008) as compared to now (2019).
On page 865, I typed the code exactly to create the generateLotsOfNumbers() function but receive this error when trying to compile:
Code:
'Program.generateLotsOfNumbers(int)': not all code paths return a value
I'm not at all sure what's going on as the book indicates there is nothing wrong with this code.
code:
Code:
private static int[] generateLotsOfNumbers(int count)
{
Random generator = new Random(0);
int[] result = new int[count];
for (int i = 0; i < count; i++)
{
result[i] = generator.Next();
}
}