I'm looking to implement an extension method similar to this:
public static bool RemoveNode(this YamlDocument doc, YamlNode node)
{
}
Basically, I have a YamlDocument
, and a YamlNode
I would like to remove from that document. Neither YamlDocument
or YamlNode
appear to have any sort of Remove
method. Judging by the source code, it looks like child nodes (at least for Mapping Nodes) are stored in the children
dictionary, which could be accessed through the Children
property. I would probably also need to solve this for removing sequence nodes and scalar nodes. If anyone has solved this issue, I'd love to hear your approach.
Also, I ran across another library called SharpYaml (which appears to be a fork of YamlDotNet) which has methods build in to remove nodes. However, at the moment it would be somewhat of a high cost to switch out Yaml libraries. So, that's a last resort.