title: Enums and subtraction operator
body: <p>Does anyone know (and perhaps: since when) the <code>-=</code> operator is supported on <code>enum</code> values?</p>
  
  <p>I was happily coding away today when I, for some reason, wrote this to exclude a value from a flags <code>enum</code>:</p>
  
  <pre><code>flags -= FlagsEnum.Value1;
  </code></pre>
  
  <p>After rereading and evaluating my code, I was surprised that it compiled actually worked.</p>
  
  <p>Writing the statement as </p>
  
  <pre><code>flags = flags - FlagsEnum.Value1
  </code></pre>
  
  <p>however does <strong><em>not</em></strong> compile.</p>
  
  <p>I couldn't find anything in the documentation and on internet so far. Also, other operators (apart from the bit operators, of course) are not supported: <code>+=</code> (including a flag) , <code>*=</code> (intersection in Pascal) don't work. </p>
  
  <p>Is this some syntactic sugar built into the C# compiler? If so, any reason why they chose not to include other operators?</p>
  
  <p>A simple code sample:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace ConsoleApplication4
  {
      [Flags]
      enum FlagsEnum
      {
          None = 0,
          Value1 = 1,
          Value2 = 2,
          Value3 = 4
      }
  
      class Program
      {
          static void Main(string[] args)
          {
              FlagsEnum flags = FlagsEnum.Value1 | FlagsEnum.Value2 | FlagsEnum.Value3;
              Console.WriteLine(flags);
              flags -= FlagsEnum.Value1;
              Console.WriteLine(flags);
              flags -= FlagsEnum.Value3;
              Console.WriteLine(flags);
              flags -= FlagsEnum.Value2;
              Console.WriteLine(flags);
              Console.ReadLine();
          }
      }
  }
  </code></pre>