T
IdeaBlade DevForce 2010 Help Reference
Or<T>(Expression<Func<T,Boolean>>,Expression<Func<T,Boolean>>) Method
See Also  Example Send Feedback
IdeaBlade.Linq Assembly > IdeaBlade.Linq Namespace > PredicateBuilder Class > Or Method : Or<T>(Expression<Func<T,Boolean>>,Expression<Func<T,Boolean>>) Method



left
First operand
right
Second operand
Returns an expression which represents a conditional OR operation.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Function Or(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)Copy Code
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.Or(Of T)(left, right)

Parameters

left
First operand
right
Second operand

Type Parameters

T

Example

C#Copy Code
public void OrQuery() {
  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 or country = mexico
  var finalcrit = crit1.Or(crit2);
  var query = mgr.Customers.Where(finalcrit);
  var list = query.ToList();
}

Remarks

The resulting expression is an "OrElse" binary expression, where the second operand will be evaluated only if the first operand is true.

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.