title: LINQ Expression for Contains
body: <p>I want to add dynamic expression in linq but facing issues on contains method it is working perfectly for Equal method</p>
  
  <p>Problem is i'm getting <code>FilterField</code> dynamically how to replace in query </p>
  
  <p>So far i had tried</p>
  
  <pre><code>List&lt;int&gt; Ids = new List&lt;int&gt;();  
  **string filterField ="DEPARTMENT"; ==&gt; Dynamic Field**
  
  var eParam = Expression.Parameter(typeof(EmployeeDetail), "e");
  
  var comparison = Expression.Equal(Expression.Property(eParam, filterField), Expression.Convert(Expression.Constant(Ids), Expression.Property(eParam, filterField).Type));
  
  var lambda = Expression.Lambda&lt;Func&lt;EmployeeDetail, bool&gt;&gt;(comparison, eParam);
  
  var countMonthly1 = ctx.tblMonthlyInput.Join(ctx.tblEmployee, a =&gt; a.CompanyId, b =&gt; b.CompanyId, (a, b) =&gt; b).Where(lambda).Count();
  </code></pre>
  
  <p>I want to make above query works for Contains method using linq expression</p>
  
  <p>sample query  :  </p>
  
  <pre><code>var countMonthly = (from a in ctx.tblMonthlyInput
                      join b in ctx.tblEmployee on a.CompanyId equals b.CompanyId
                      where categoryId.Contains(a.CategoryId)  //want to make this dynamic
                      select a).Count() == 0;
  </code></pre>