I'd like to declare an array of int rows
with a variable size (X
) and init all values to 1. For the moment I use this :
int[] rows = new int[X];
for (int i = 0; i < rows.Length; i++)
{
rows[i] = 1;
}
Is there any faster/shorter way to do it with some sort of fill(1)
or int[] rows = new int[X] {1};
?