title: Printing Flags Enum as Separate Flags
body: <p>I have a flags enum defined like this:</p>
  
  <pre><code>[Flags]
  public enum MyEnum
  {
      None =     0x00,
      Choice1 =  0x01,
      Choice2 =  0x02,
      Choice3 =  0x04,
      Default =  Choice1 | Choice2,
      All =      Default | Choice3
  }
  </code></pre>
  
  <p>I would like a way to print out which flags are included in <code>MyEnum.Default</code>.  In this case, I'd want the output to be something like "Choice1, Choice2".</p>
  
  <p>The problem with simply printing <code>MyEnum.Default.ToString()</code> is that the output would be "Default" when I want "Choice1, Choice2".</p>
  
  <p>Here's one option, but if I used this I'd have to update the printing every time I changed the enum.</p>
  
  <pre><code>((StudyData.Choice1 &amp; StudyData.Default) == StudyData.Choice1 ? StudyData.Choice1.ToString() : "") + ", " +
  ((StudyData.Choice2 &amp; StudyData.Default) == StudyData.Choice2 ? StudyData.Choice2.ToString() : "") + ", " +
  ((StudyData.Choice3 &amp; StudyData.Default) == StudyData.Choice3 ? StudyData.Choice3.ToString() : "")
  </code></pre>
  
  <p>Does anyone have a cleaner way of doing this?  Ideally, I'd like a way of printing out the flags included in <code>MyEnum.Default</code> without having to change the printing code every time I added a new flag or changed the default.</p>
  
  <p>Thanks!</p>