title: Retrieve the names of all the boolean properties of a class which are true
body: <p>I have a class that has lots of bool properties. How can I create another property that is a list of strings that contains the name of the properties which have a value of true?</p>
  
  <p>See initial attempt below - can't quite figure out how to filter the true ones</p>
  
  <pre><code>public class UserSettings
  {
      public int ContactId { get; set; }
      public bool ShowNewLayout { get; set; }
      public bool HomeEnabled { get; set; }
      public bool AccountEnabled { get; set; }
  
      // lots more bool properties here
  
      public IEnumerable&lt;string&gt; Settings
      {
          get
          {
              return GetType()
                  .GetProperties()
                  .Where(o =&gt; (bool)o.GetValue(this, null) == true) //this line is obviously wrong
                  .Select(o =&gt; nameof(o));
          }
      }
  }
  </code></pre>