YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

How to serialize properties with blank lines between them

Open emanuel-v-r opened this issue 1 year ago • 0 comments

How to place some blank lines between properties. In my case this is helpful for separating sections of the yaml.

Example:

Considering this class:

public class MyYaml
{
    public Section Section1 { get; set; }

    public Section Section2 { get; set; }
}

I am getting this:

section1: 
  name: section 1 name
section2: 
  name: section 2 name

But I want this:

section1: 
  name: section 1 name

section2: 
  name: section 2 name

Tried to emmit a Scalar event with a break line, but it does not work properly as introduces some other chars. I guess that there might be a cleaner way of doing this

emanuel-v-r avatar Apr 27 '23 16:04 emanuel-v-r