I am trying to format the name of property of an object according to value I am getting in the output of my yaml file. I am using yamldotnet library. Below are my classes
State.cs
public class State
{
public string name { get; set; }
public List<Operation> operations { get; set; }
}
Operation.cs
public class Operation
{
public string name { get; set; }
public string type { get; set; }
}
In the state class, I have list of operations. After serializing, I am getting the following yaml output:
states:
- name: uPError
operations:
- name: switch on uP
type: entry
- name: switch off uP
type: exit
- name: test Do
type: do
But the format I intend to display is as follows:
states:
- name: uPError
entryActions: [switch on uP]
exitActions: [switch off uP]
doActions: [test Do]
I am getting the types and their name, based on the type, I need to change it to entryAction, exitActions or doActions and then append the corresponding name. How can I achieve the above intended format? Thanks in advance.