title: What is the most efficent way to perform boolean logic operations in C#.NET?
body: <p>I'm writing a plugin for another piece of sofware we use in my office that will allow users to audit the files they are working on. I'm trying to keep my tool as flexible as possible. The idea I have is that the user will generate a tree of Nodes that can contain other Nodes as sub-nodes. At the bottom of the tree the Nodes will be condition nodes that will either fail or pass depending on the file the user is working in. In addition, the user can set each Node to a specific logic type including AND, OR, NOR, NAND.</p>
  
  <pre><code>AND:  All sub nodes must pass 
  OR:   At least one sub node must pass 
  NAND: At least one sub node must fail
  NOR:  All sub nodes must fail 
  </code></pre>
  
  <p>What I'm trying to figure out now is if I have some collection of bool's that were returned by a node or sub-node, what is the most efficient way to apply the logic types above to this list? Off hand I started writing <code>foreach</code> statments, but it seems since binary logic is so fundamental to the way computers work there would be a better, faster, and less iterative method.</p>