public static YAMLNode ExportYAML <T>(this IReadOnlyDictionary <string, T> _this) where T : IYAMLExportable { YAMLSequenceNode node = new YAMLSequenceNode(); node.Style = SequenceStyle.Block; foreach (var kvp in _this) { YAMLMappingNode map = new YAMLMappingNode(); map.Add(kvp.Key, kvp.Value.ExportYAML()); node.Add(map); } return(node); }
public static YAMLNode ExportYAML <T>(this IReadOnlyDictionary <T, float> _this) where T : IYAMLExportable { YAMLSequenceNode node = new YAMLSequenceNode(); node.Style = SequenceStyle.Block; foreach (var kvp in _this) { YAMLMappingNode map = new YAMLMappingNode(); YAMLNode key = kvp.Key.ExportYAML(); if (key.NodeType == YAMLNodeType.Scalar) { map.Add(key, kvp.Value); } else { map.Add("first", key); map.Add("second", kvp.Value); } node.Add(map); } return(node); }