允许用户为 SearchExpressionEvaluatorAttribute 添加更多函数签名重载。
这是一个具有 2 个函数签名的评估器
[Description("Convert arguments to a string allowing you to format the result.")] [SearchExpressionEvaluator(SearchExpressionType.Selector | SearchExpressionType.Text, SearchExpressionType.Iterable | SearchExpressionType.Literal | SearchExpressionType.Variadic)] [SearchExpressionEvaluatorSignatureOverload(SearchExpressionType.Iterable | SearchExpressionType.Literal | SearchExpressionType.Variadic)] public static IEnumerable<SearchItem> FormatItems(SearchExpressionContext c) { var skipCount = 0; if (SearchExpression.GetFormatString(c.args[0], out var formatStr)) skipCount++; var items = c.args.Skip(skipCount).SelectMany(e => e.Execute(c)); var dataSet = SearchExpression.ProcessValues(items, null, item => SearchExpression.FormatItem(c.search, item, formatStr)); return dataSet; }
SearchExpressionEvaluatorSignatureOverloadAttribute | 为现有的 SearchExpressionEvaluator 添加重载签名。 |