T
IdeaBlade DevForce 2010 Help Reference
True<T> Method
See Also  Example Send Feedback
IdeaBlade.Linq Assembly > IdeaBlade.Linq Namespace > PredicateBuilder Class : True<T> Method



Returns an expression evaluating to true.

Syntax

Visual Basic (Declaration) 
Public Shared Function True(Of T)() As Expression(Of Func(Of T,Boolean))
Visual Basic (Usage)Copy Code
Dim value As Expression(Of Func(Of T,Boolean))
 
value = PredicateBuilder.True(Of T)()
C# 
public static Expression<Func<T,bool>> True<T>()
C++/CLI 
public:
static Expression<Func<T^,bool>^>^ Truegeneric<typename T>
(); 

Type Parameters

T

Example

C#Copy Code
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();
}

Remarks

Can be used as the base expression when building a dynamic predicate containing an unknown number of expressions.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.