PredicateBuilder.New vs PredicateBuilder.True : <p>I am using PredicateBuilder to create a search/filter section in my action.  Here it is:</p>

<pre><code>    [HttpPost]
    public ActionResult Test(int? cty, string inumber, int? page)
    {

        var lstValues =
            db.TableName.Include(x =&gt; x.Table1)
                .Include(x =&gt; x.Table2)
                .Include(x =&gt; x.Table3)
                .ToList();

        var predicate = PredicateBuilder.True&lt;TableName&gt;();

        if (!string.IsNullOrWhiteSpace(inumber))
        {
            predicate = predicate.And(x =&gt; x.Inumber == inumber);
        }

        if (!string.IsNullOrWhiteSpace(cty.ToString()))
        {
            predicate = predicate.And(x =&gt; x.CtyID == cty);
        }

        if (predicate.Parameters.Count &gt; 0)
        {
            lstValues = db.TableName.AsExpandable().Where(predicate).ToList();
            Session["Paging"] = lstValues;
            ViewBag.Paging = lstValues.ToPagedList(page ?? 1, 2);
            return View(lstValues.ToPagedList(page ?? 1, 2));
        }
        else
        {
            return View(lstValues.ToPagedList(page ?? 1, 2));
        }
    }
</code></pre>

<p>Under this line <code>PredicateBuilder.True&lt;TableName&gt;();</code> I get a green squiggly saying</p>

<blockquote>
  <p>PredicateBuilder.True() is obsolete. Use PredicateBuilder.New instead.</p>
</blockquote>

<p>But I have tried <code>PredicateBuilder.New&lt;T&gt;</code> and my predicate always gets a value of <code>1</code> even if I don't have any values coming in for the parameters, so <code>cty</code>, and <code>inumber</code> are null.  This returns me an empty table.. when it should be returning all records by entering the <code>else</code> statement with  <code>return View(lstValues.ToPagedList(page ?? 1, 2));</code>.</p>

<p>When I use <code>PredicateBuilder.True&lt;T&gt;</code> I get all records returned when all of the parameters are null.</p>

<p>Any idea on why that is?  Any help is appreciated.</p>
