IdeaBlade.Linq Assembly > IdeaBlade.Linq Namespace > PredicateBuilder Class > Or Method : Or<T>(Expression<Func<T,Boolean>>,Expression<Func<T,Boolean>>) Method |
'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))
'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.Or(Of T)(left, right)
[Extension()] public static Expression<Func<T,bool>> Or<T>( Expression<Func<T,bool>> left, Expression<Func<T,bool>> right )
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(); }
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