using System.Collections.Generic;
using YamlDotNet.RepresentationModel;
namespace YamlDotNet.Samples
public class LoadYamlStream
public static void Main()
var input = new StringReader(Document);
var yaml = new YamlStream();
(YamlMappingNode)yaml.Documents[0].RootNode;
foreach (var entry in mapping.Children)
var node = (YamlScalarNode)entry.Key;
Console.WriteLine("{0}: {1}", (node).Value, mapping.Children[(YamlScalarNode)entry.Key]);
private const string Document = @"---
receipt: Oz-Ware Purchase Invoice # with comment
- IF(%ABC% LIKE 'TEXT'): # Комментарий
OK: EXIT # Все успешно, выходим
S_DELAY: # Нужна задержка перед повтором
- MESSAGE(ABC) # ЧТО-ТО ПОШЛО НЕ ТАК
descrip: Water Bucket (Filled)
descrip: High Heeled ""Ruby"" Slippers
Road to the Emerald City.