Suppose I have an array filled with Boolean values and I want to know how many of the elements are true.
private bool[] testArray = new bool[10] { true, false, t
Use LINQ. You can do testArray.Where(c => c).Count(); for true count or use testArray.Where(c => !c).Count(); for false check
testArray.Where(c => c).Count();
testArray.Where(c => !c).Count();