title: Convert some bool properties to a flags enum
body: <p>I need to convert a legacy class with 3 bool properties to a flag enum.</p>
  
  <p>I know that at least one of those properties is true.</p>
  
  <pre><code>[Flags]
  public enum FlagEnum
  {
      EnumValue1 = 1,
      EnumValue2 = 2,
      EnumValue3 = 4
  }
  
  public class LegacyClass
  {
      public bool PropA { get; set; }
      public bool PropB { get; set; }
      public bool PropC { get; set; }
  }
  
  public class DtoClass
  {
      public FlagEnum FlagEnum { get; set; }
  
      public DtoClass(LegacyClass legacyClass)
      {
          if (!legacyClass.PropA &amp;&amp; !legacyClass.PropB &amp;&amp; !legacyClass.PropC)
          {
              throw new ArgumentException();
          }
  
          if (legacyClass.PropA)
          {
              FlagEnum = FlagEnum.EnumValue1;
          }
          if (legacyClass.PropB)
          {
              if (legacyClass.PropA)
              {
                  FlagEnum = FlagEnum.EnumValue1|FlagEnum.EnumValue2;
              }
              else
              {
                  FlagEnum = FlagEnum.EnumValue2;
              }
          }
          if (legacyClass.PropC)
          {
              if (legacyClass.PropA||legacyClass.PropB)
              {
                  FlagEnum = FlagEnum | FlagEnum.EnumValue3;
              }
              else
              {
                  FlagEnum = FlagEnum.EnumValue3;
              }
          }
      }
  }
  </code></pre>
  
  <p>Is there a more elegant or concise way to do this considering that I may run into a case with even more properties and flags to set?</p>