Skip to content

Linq Select throws exception (ValueTuple?) issue? #139

Open
@yggdrasil-tynor

Description

@yggdrasil-tynor
context.AddVariable("list1", new int[] { 1, 2, 3, 8 });
context.AddVariable("list2", new int[] { 4, 5, 6, 7 });
var test = context.Evaluate("list1.Cast<int>().Select<int, int>((item, i) => item - list1[i]).Cast<int>().Sum()");

throws:

ExpressionEvaluatorSyntaxErrorException : The call of the method "Sum" on type [System.Linq.Enumerable+SelectArrayIterator`2[System.Int32,System.Int32]] generate this error : Index was outside the bounds of the array.

With Zip or EquiZip it works fine:

list1.Cast<int>().EquiZip<int, int, int>(list2, (l1, l2) => l1 + l2).Cast<int>().Sum()"

What is wrong with select?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions