question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve formatting of multidimensional arrays

See original GitHub issue

When calling Formatter.ToString(object) on a jagged array such as

new int[][]
{
    new[] { 1, 2 },
    new[] { 3, 4 }
};

the output contains the nested structure as expected.

{{1, 2}, {3, 4}}

Calling Formatter.ToString(object) on a multidimensional array such as

new int[,]
{
    { 1, 2 },
    { 3, 4 }
};

gives an unexpected (and perhaps confusing) visual result, as it doesn’t contain the nested structure.

{1, 2, 3, 4}

This could probably be improved by introducing a new MultidimensionalArrayFormatter which checks if the object is an Array and has Rank >= 2.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dennisdoomencommented, May 12, 2019

do I need to update documentation?

Nah. I don’t think we mention the exact output anywhere else.

0reactions
jnyrupcommented, May 15, 2019

Fixed in #1044

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting Multi dimensional arrays Python
How can I write a code that changes the values of each individual arrays within the multidimensional array a to zeroes right after...
Read more >
Multidimensional Arrays in Java
Representation of 2D array in Tabular Format: A two – dimensional array can be seen as a table with 'x' rows and 'y'...
Read more >
Row- and column-major order
In computing, row-major order and column-major order are methods for storing multidimensional arrays in linear storage such as random access memory.
Read more >
How to Create and Manage Multidimensional Arrays Using ...
In this article we will get more detailed into arrays, how they work, creating multidimensional arrays, and looping through them to work with...
Read more >
Visual Basic Multidimensional Arrays
In visual basic, Multidimensional Arrays can be declared by specifying the data type of an elements followed by the brackets () with comma...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found