aaubry / YamlDotNet

YamlDotNet is a .NET library for YAML
MIT License
2.55k stars 478 forks source link

Questions about multidimensional arrays #770

Open Fallen-G opened 1 year ago

Fallen-G commented 1 year ago

Hello, I want to generate a two-dimensional array, but the result is not quite what I expected.

This is my code:

using YamlDotNet.Serialization;

var serializer = new Serializer();

var array = new[,] { { 1, 1, 1 }, { 2, 2, 2 } };

serializer.Serialize(Console.Out, array);

And then, this is the output:

- 1
- 1
- 1
- 2
- 2
- 2

Expected output:

- - 1
  - 1
  - 1
- - 2
  - 2
  - 2 

Maybe I need to change some configurations, but my English is not very good. I can't find any relevant examples. Can you give me some tips or help?

Environment:

image image

EdwardCooke commented 1 year ago

That looks like a bug to me. When I get some time I can try and figure this out, however, we do accept pull requests, so if you want to give it a shot, go for it.

EdwardCooke commented 3 months ago

I’ll work on this and try and squeeze it into the next release.