📜  如何为布尔数组执行 foreach 循环 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:57.708000             🧑  作者: Mango

代码示例1
// The problem is not that your array is boolean,
 // it is that you are trying to assign value to buttonBoolean in foreach loop. It is read-only as every foreach iteration variable is
 
 // You could do this instead:
 
 public bool[] inputBool;
      
     for(int i = 0; i < inputBool.Length; i++) {
       inputBool[i] = false;
     }