From 8db407874b870edca5a85a9503faba2f0b720bf8 Mon Sep 17 00:00:00 2001 From: Max Hayman Date: Wed, 23 Aug 2023 12:21:39 +0100 Subject: [PATCH] perf: prevent multiple enumeration in GenericArgsSatisfy which was causing evaluation of parameters twice --- JsonLogic.Net/EvaluateOperators.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/JsonLogic.Net/EvaluateOperators.cs b/JsonLogic.Net/EvaluateOperators.cs index 18a2146..eb9e6c8 100644 --- a/JsonLogic.Net/EvaluateOperators.cs +++ b/JsonLogic.Net/EvaluateOperators.cs @@ -320,8 +320,9 @@ private Func GenericArgsSatisfy(Fun return (p, args, data) => { var values = args - .Select(a => p.Apply(a, data)); - + .Select(a => p.Apply(a, data)) + .ToList(); + var isAllText = values .Where(a => a != null) .Select(a => JToken.FromObject(a))