title: How to use LINQ Where for generic type?
body: <p>I have the following generic method that I need to be able to perform a LINQ Where query in:</p>
  
  <pre><code>public static List&lt;T&gt; GetItems&lt;T&gt;(Guid parentId = new Guid()) where T : new()
  {
      var db = new SQLiteConnection(_dbPath);
      List&lt;T&gt; result;
  
      if (parentId != Guid.Empty)
      {
          result = db.Table&lt;T&gt;().Where(i =&gt; i.ParentId.Equals(parentId)).ToList();
      }
      else
      {
          result = db.Table&lt;T&gt;().ToList();
      }
  
      db.Close();
      return result;
  }
  </code></pre>
  
  <p>The compiler doesn't like the following line </p>
  
  <pre><code>result = db.Table&lt;T&gt;().Where(i =&gt; i.ParentId.Equals(parentId)).ToList();
  </code></pre>
  
  <blockquote>
    <p>error: cannot resolve 'ParentId'</p>
  </blockquote>
  
  <p>Is it possible to use generics in this way in a LINQ query? Note that object of type T will always have a ParentId property.</p>