Visual Basic (Declaration) | |
---|---|
<ExtensionAttribute()> Public Overloads Shared Function And(Of T)( _ ByVal left As Expression(Of Func(Of T,Boolean)), _ ByVal right As Expression(Of Func(Of T,Boolean)) _ ) As Expression(Of Func(Of T,Boolean)) |
Visual Basic (Usage) | ![]() |
---|---|
Dim left As Expression(Of Func(Of T,Boolean)) Dim right As Expression(Of Func(Of T,Boolean)) Dim value As Expression(Of Func(Of T,Boolean)) value = PredicateBuilder.And(Of T)(left, right) |
C# | |
---|---|
[ExtensionAttribute()] public static Expression<Func<T,bool>> And<T>( Expression<Func<T,bool>> left, Expression<Func<T,bool>> right ) |
C++/CLI | |
---|---|
[ExtensionAttribute()] public: static Expression<Func<T^,bool>^>^ Andgeneric<typename T> ( Expression<Func<T^,bool>^>^ left, Expression<Func<T^,bool>^>^ right ) |
Parameters
- left
- First operand
- right
- Second operation
Type Parameters
- T
C# | ![]() |
---|---|
public void AndQuery() { var mgr = new DomainModelEntityManager(); Expression<Func<Customer, bool>> crit1 = c => c.Country.Equals("Mexico"); Expression<Func<Customer, bool>> crit2 = c => c.CompanyName.StartsWith("A"); // Where companyname starts with A and country = mexico var finalcrit = crit1.And(crit2); var query = mgr.Customers.Where(finalcrit); var list = query.ToList(); } |
The resulting expression is an "AndAlso" binary expression, where the second operand will be evaluated only if the first operand is true.
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