title: Neatest way to 'OR' all values in a Flagged Enum?
body: <p>Given the <code>enum</code>:</p>
  
  <pre><code>[Flags]
  public enum mytest
  {
      a = 1,
      b = 2,
      c = 4
  }
  </code></pre>
  
  <p>I've come up with two ways to represent all values in a single variable:</p>
  
  <pre><code>    var OR1 = (mytest)Enum.GetNames(typeof(mytest)).Sum(a =&gt; (int)Enum.Parse(typeof(mytest), a));
      var OR2 = (mytest)(typeof(mytest).GetEnumValues() as mytest[]).Sum(a =&gt; (int)a);
  </code></pre>
  
  <p>Now, although they both work, is there a neater way? Possibly a .NET method I'm missing?</p>
  
  <p>Edit: For clarification, I need the function to be dynamic - I don't want to calculate it by specifying every single <code>enum</code> value.</p>