本文整理汇总了C#中System.Linq.Expressions.Expression.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Count方法的具体用法?C# Expression.Count怎么用?C# Expression.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.Expression
的用法示例。
在下文中一共展示了Expression.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SeekFunction
internal static Function SeekFunction(string name, Expression[] arguments, bool seekInsideObservable = false)
{
var qualifiedName = string.Format("{0}({1})", name, arguments.Count());
// TODO: Handle missing function events
var function = ExpressionsHelper.functions.Where(f => f.FunctionName.Equals(qualifiedName)
&& arguments.Select(a =>
{
var type = a.Type.GetFirstObservableGenericType();
if (type == null || seekInsideObservable == false)
{
return a.Type;
}
return type;
})
.SequenceEqual(f.Parameters
.Select(p => p.Type))).FirstOrDefault();
return function;
}
示例2: ExpectArgsCount
private static void ExpectArgsCount(int count, Expression[] args, string method)
{
if (args.Count() != count)
throw new EqlCompilerException($"Method '{method}' expects {count} argument(s) but {args.Count()} were supplied");
}
示例3: ExpectArgsCountBetween
private static void ExpectArgsCountBetween(int low, int high, Expression[] args, string method)
{
if (args.Count() < low || args.Count() > high)
throw new EqlCompilerException($"Method '{method}' expects {low}-{high} argument(s) but {args.Count()} were supplied");
}
示例4: MakeOptionalFilterArgumentCall
private static Expression MakeOptionalFilterArgumentCall(Expression context, Expression argContext, string methodName, Expression[] args, string actualMethodName)
{
ExpectArgsCountBetween(0, 1, args, methodName);
var allArgs = new List<Expression> { context };
if (args.Count() == 1) {
var predicate = args.First();
ExpectArgTypeToBe(predicate.Type, typeof(bool), methodName);
allArgs.Add(Expression.Lambda(predicate, argContext as ParameterExpression));
}
return ExpressionUtil.MakeExpressionCall(new []{typeof(Queryable), typeof(Enumerable)}, actualMethodName, new Type[] {argContext.Type}, allArgs.ToArray());
}