I found this code snippet on a different post that I don't quite understand and would appriciate someone explaining.
private bool[] GetPageNumbersToLink(IPagedResult result)
{
if (result.TotalPages <= 9)
return new bool[result.TotalPages + 1].Select(b => true).ToArray();
...
http://stackoverflow.com/questions/136836/c-array-initialization-with-non-default-value
My take on this:
new bool[result.TotalPages + 1]
this creates an array of bools with length equal to that of the totalpages, the default value being false on all of them.
.Select(b => true)
this uses a linq query to return only the items that are true, i.e. none of them
.ToArray();
linq returns IEnumerable or something, so it needs to go back to a new array, of length 0 as none were selected in the first place.
I think that's what it's doing, but it doesn't make any sense.