当前位置: 首页>>代码示例>>C#>>正文


C# Expression.Or方法代码示例

本文整理汇总了C#中System.Linq.Expressions.Expression.Or方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Or方法的具体用法?C# Expression.Or怎么用?C# Expression.Or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Linq.Expressions.Expression的用法示例。


在下文中一共展示了Expression.Or方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     if (operation != 1 && operation != 2 && operation != 3)
     {
         return predicate;
     }
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.operation + " on " + this.date.Date);
         switch (operation)
         {
             case 1: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
             case 2: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
             case 3: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
             default: return predicate;
         }
     }
     else
     {
         Debug.WriteLine("And " + this.operation + " on " + this.date.Date);
         switch (operation)
         {
             case 1: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
             case 2: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
             case 3: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
             default: return predicate;
         }
     }
 }
开发者ID:CactidSpoder,项目名称:Unbrickable,代码行数:29,代码来源:DateSearchFilter.cs

示例2: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.min_date.Date + " to " + this.max_date.Date);
         return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= min_date && DbFunctions.TruncateTime(x.date_posted) <= max_date);
     }
     else
     {
         Debug.WriteLine("And " + this.min_date.Date + " to " + this.max_date.Date);
         return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= min_date && DbFunctions.TruncateTime(x.date_posted) <= max_date);
     }
 }
开发者ID:CactidSpoder,项目名称:Unbrickable,代码行数:13,代码来源:DateRangeSearchFilter.cs

示例3: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     this.username = this.username ?? "";
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.username);
         return predicate.Or(x => x.Account.username.Equals(this.username));
     }
     else
     {
         Debug.WriteLine("And " + this.username);
         return predicate.And(x => x.Account.username.Equals(this.username));
     }
 }
开发者ID:CactidSpoder,项目名称:Unbrickable,代码行数:14,代码来源:UsernameSearchFilter.cs

示例4: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     this.search_contents = this.search_contents ?? "";
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.search_contents);
         return predicate.Or(x => x.entry.Contains(this.search_contents));
     }
     else
     {
         Debug.WriteLine("And " + this.search_contents);
         return predicate.And(x => x.entry.Contains(this.search_contents));
     }
 }
开发者ID:CactidSpoder,项目名称:Unbrickable,代码行数:14,代码来源:PostSearchFilter.cs

示例5: TestOr_LeftIsNull

 public void TestOr_LeftIsNull() {
     _expression1 = null;
     var andExpression = _expression1.Or( _expression2 ).ToLambda<Func<Person, bool>>( _parameterExpression );
     Expression<Func<Person, bool>> expected = t => t.Birthday.Value.Year > 2000;
     Assert.AreEqual( expected.ToString(), andExpression.ToString() );
 }
开发者ID:NetUtil,项目名称:Util,代码行数:6,代码来源:ExpressionExtensionTest.cs


注:本文中的System.Linq.Expressions.Expression.Or方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。