DevForce Help Reference
True<T> Method
Example 


Returns an expression evaluating to true.
Syntax
'Declaration
 
Public Shared Function True(Of T)() As Expression(Of Func(Of T,Boolean))
'Usage
 
Dim value As Expression(Of Func(Of T,Boolean))
 
value = PredicateBuilder.True(Of T)()
public static Expression<Func<T,bool>> True<T>()

Type Parameters

T
Remarks
Can be used as the base expression when building a dynamic predicate containing an unknown number of expressions.
Example
private void GetProducts(bool checkDiscontinued, bool checkLevel) {
  var predicate = PredicateBuilder.True<Product>();
  if (checkDiscontinued) predicate = predicate.And(p => p.Discontinued == false);
  if (checkLevel) predicate = predicate.And(p => p.ReorderLevel < 10);

  var query = mgr.Products.Where(predicate);
  var list = query.ToList();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PredicateBuilder Class
PredicateBuilder Members

Send Feedback