If you are using .NET 2.0, using a loop is the right way to do this. I would not change it.
The original answer.
Your ad type is incorrect. Try the following:
bool[] weekSelected = new bool[] { true, true, true, true, true };
You can also do this so as not to repeat yourself:
bool[] weekSelected = Enumerable.Repeat(true, 5).ToArray();
Please note that this is not as efficient as the loop, but if you say that 100 values ββand performance are not critical, it is shorter than the loop and takes less text than { true, true, true, ... } .
source share