Is it possible to do the following (e.g. initialize bool array and set all elements to true) in one line using object initializers?
int weeks = 5;
bool[] weekSelected = new bool[weeks];
for (int i = 0; i < weeks; i++)
{
weekSelected[i] = true;
}
I can't quite get it to work.
Edit: I should have mentioned that I am using VS2008 with .NET 2.0 (so Enumerable won't work).