feat: support multi-dimensional array indexing and iteration - #649
Merged
Conversation
) C# true multi-dimensional arrays (rank > 1, e.g. int[,]) previously threw when indexed via path expressions (Array's non-generic IList indexer rejects rank > 1) or iterated with {{#each}} (cast to T[] failed for non-SZArrays). Adds a lazy MultidimensionalArraySlice view that lets a rank-N array be walked one dimension at a time - {{grid.[0].[1]}} indexes dimension by dimension, and {{#each}} iterates the outer-most dimension, yielding row/slab slices for the remaining dimensions. Jagged arrays and IList/IEnumerable behavior are unaffected since rank-1 arrays keep using the existing code path.
rexm
enabled auto-merge
August 5, 2026 04:14
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
int[,]) previously threw when indexed via path expressions (Array's non-genericIListindexer rejects rank > 1) or iterated with{{#each}}(cast toT[]failed for non-SZArrays).MultidimensionalArraySliceview that lets a rank-N array be walked one dimension at a time:{{grid.[0].[1]}}indexes dimension by dimension, and{{#each}}iterates the outer-most dimension, yielding row/slab slices for the remaining dimensions (matches how users conceptually think of a 2D array as rows).IList/IEnumerablebehavior are unaffected — rank-1 arrays keep using the existing code path.Test plan
IteratorTests.cs/BasicIntegrationTests.cs: jagged-array regression, 2D#each(including@index), 3D nested#each, 2D/3D path indexingFixes #483
🤖 Generated with Claude Code