title: How can I search in a list for elements that contain a substring in any of their property values?
body: <p>I am trying to search in a list of objects with a lot of properties. Looking for an elegant solution such as a lambda expression that can return a result based on a search string. This is my data source in simplified form. My actual <code>Customer</code> class has lots more properties:</p>
  
  <pre><code>public static class CustomerDataSource
  {
      public static List&lt;Customer&gt; customerData
      {
          get
          {
              Customer customer1 = new Customer() { name = "Bert", address = "London" };
              Customer customer2 = new Customer() { name = "Jon", address = "New York" };
              List&lt;Customer&gt; listCustomers = new List&lt;Customer&gt;();
              listCustomers.Add(customer1);
              listCustomers.Add(customer2);
              return listCustomers;
          }
      }
  }
  
  public class Customer
  {
      public string name { get; set; }
      public string address { get; set; }
  }
  </code></pre>
  
  <p>What kind of statement can return all the <code>Customer</code>s that contain the 'searchstring'. For example, if the search string is 'e' then it should return both <code>customer1</code> and <code>customer2</code> because both the <code>name</code> and <code>address</code> properties for <code>customer1</code> contain 'e'.</p>
  
  <p>I could write something like the following, but then I would have to write a line of code for each property:</p>
  
  <pre><code>var list = CustomerDataSource.customerData.FindAll(x =&gt; x.address.Contains("e"));
  var list2 = CustomerDataSource.customerData.FindAll(x =&gt; x.name.Contains("e"));
  </code></pre>