このスレッドによると、複数のブール値が「真」であるかどうかをエレガントに判断します
コードのこの部分を使用して...
public bool ExceedsThreshold(int threshold, IEnumerable<bool> bools)
{
int trueCnt = 0;
foreach(bool b in bools)
if (b && (++trueCnt > threshold))
***//here i need to know which of b is the true***
return true;
return false;
}
bools 変数のどれが true か知りたいですか?