using YamlDotNet.RepresentationModel;
namespace YamlDotNet.Samples
public class ModifyingAYamlStream
public static void Main()
var input = new StringReader(Document);
var yaml = new YamlStream();
var root = (YamlMappingNode)yaml.Documents[0].RootNode;
((YamlScalarNode)root.Children["A"]["a2"]).Value = "modified";
yaml.Save(Console.Out, assignAnchors: false);
private const string Document = @"A: