我在使用这个array.All<>功能时遇到了困难.
private bool noBricksLeft() {
bool[] dead = new bool[brick.Length];
for (int i = 0; i < brick.GetLength(0); i++) {
if (brickLocation[i, 2] == 0)
dead[i] = true;
else
continue; // move onto the next brick
}
if (dead.All(dead[] == true)) // IF ALL OF THE ELEMENTS ARE TRUE
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud)
我想知道我怎么能实现if (dead.All(dead[] == true))?