Array properties don't get printed
Any chance to change this:
ConsoleDump.Extensions.Dump(new {
Array = new[] { "foo", "bar" }
});
From:
ø
{ Array = System.String[] }
Array System.String[]
To a column view that would work with multiple properties? Like a table? I understand that it would get complex really quickly if you have objects in there and not primitive types so that would be an reasonable limitation.
ConsoleDump does produce tables in 2 cases (currently):
-
Dumping a single object directly; it's field / property names are the left column and their values are the right column
ConsoleDump.Extensions.Dump(new { foo = 1, bar = "two" })produces a table similar to:
Name Value foo 1 bar two -
Dumping a collection of (strongly typed) objects. The field / property names are the column headings and each item is a row in the resulting table.
ConsoleDump.Extensions.Dump(new[] { new { foo = 1, bar = "two" }, new { foo = 3, bar = "four" }, })produces a table similar to:
foo bar 1 two 3 four
Collections of "primitives" are handled with #2. Something close to your example:
ConsoleDump.Extensions.Dump(new[] { "foo", "bar" });
| System.String[] |
|---|
| foo |
| bar |
I think nicely dumping objects containing collections would be challenging but perhaps something close could be supported.
Suggestion
I could add support for dumping collections of collections of primitives.
Hypothetical example:
ConsoleDump.Extensions.Dump(new[] {
new[] { 1, 2, 3, },
new[] { 4, 5, },
new[] { 6, 7, 8, 9, },
});
| [0] | [1] | [2] | [3] |
|---|---|---|---|
| 1 | 2 | 3 | |
| 4 | 5 | ||
| 6 | 7 | 8 | 9 |
This would .ToString() anything (the same as the currently supported table styles) so this would really be adding a special case for IEnumerable<IEnumerable<T>>
@georgiosd, would dumping a collection directly or this hypothetical collection of collection support satisfy your use case?
Uhm, what if, when a property is a collection, instead of displaying it in a table as above, you create an indented table table:
| Foo | Bar |
|---|---|
| 1 | 2 |
I => TABLE FOR COLLECTION HERE
Best of both worlds?