本文整理匯總了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());
}