Skip to content

[Feature] Multi-dimensional Arrays support #483

@oformaniuk

Description

@oformaniuk

Discussed in #450

Originally posted by nooelan May 10, 2021
My model contains data that are multi-dimensional, and my first attempt was to implement this as a regular C# multidimensional array similar to this:

object[,] matrix3x3 = new object[3,3];

When trying to access this type of object from a template, Handlebars.Net threw an exception complaining it could not convert from object[ , ] to object[].

Then I changed my model implementation to jagged arrays (similar to this):

object[][] matrix3x3 = new object[3]; 
for (row = 0; row < 3; ++row)
    matrix3x3[row] = new object[3];

This works just fine with Handlebars.Net.

Question: Is the lack of support for regular multidimensional arrays intentional, or is it a missing feature or bug?

As regular, multidimensional arrays are more efficient, at least for 2D arrays according to C# guidelines, I think it is a good idea to add support for it. It will also help avoid having to change the implementation of an already existing model.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions