Visual Basic (Declaration) | |
---|---|
Public Shared Function True(Of T)() As Expression(Of Func(Of T,Boolean)) |
Visual Basic (Usage) | ![]() |
---|---|
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
C# | ![]() |
---|---|
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(); } |
Can be used as the base expression when building a dynamic predicate containing an unknown number of expressions.
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