To implement the mocked foreach, I use an extension method:
public static class Extend
{
public static void All<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (var item in source)
action(item);
}
}
I want to change the money field of each npc in List<Npc> NearNpcs to 10, so I wrote a Lambda string:
"NearNpcs.All(n=>n.money=10)"
(The InterpreterOptions.LambdaExpressions setting is already turned on, and the Extend class and associated required variables are registered.)
It reported the error:
DynamicExpresso.Exceptions.ParseException: A value of type 'Int32' cannot be converted to type 'Boolean' (at index 0).
Does Lambda parsing currently only support conditional parsing that can return bool?
To implement the mocked foreach, I use an extension method:
I want to change the money field of each npc in
List<Npc> NearNpcsto 10, so I wrote a Lambda string:"NearNpcs.All(n=>n.money=10)"(The
InterpreterOptions.LambdaExpressionssetting is already turned on, and theExtendclass and associated required variables are registered.)It reported the error:
Does Lambda parsing currently only support conditional parsing that can return bool?