One false will return false with the logical logic AND .
You can also rewrite it as:
return Booleans.All(b => b);
For completeness, or if LINQ is not an option, you can achieve the same through a loop:
var list = new List<bool> { true, false, true }; bool result = true; foreach (var item in list) { result &= item; if (!item) break; } Console.WriteLine(result);
For small samples, what you have is good, but as the number of elements increases, one of the above methods will make the code more friendly.
Ahmad mageed
source share