private bool TryGetValueByYamlKeyAndType(YamlScalarNode yamlKey, Type type, out object result) { if (mappingNode.Children.ContainsKey(yamlKey)) { var value = mappingNode.Children[yamlKey]; if (YamlDoc.TryMapValue(value, out result)) { return(true); } } return(FailToGetValue(out result)); }
private bool TryGetValueByYamlKeyAndType(YamlScalarNode yamlKey, Type type, out object result) { if (mappingNode.Children.ContainsKey(yamlKey)) { var value = mappingNode.Children[yamlKey]; if (YamlDoc.TryMapValue(value, out result)) { return(true); } } return(IsNullableType(type) ? SuccessfullyGetValue(new DynamicYaml((YamlNode)null), out result) : FailToGetValue(out result)); }
private bool TryGetValueByIndex(int index, out object result) { if (sequenceNode == null) { return(FailToGetValue(out result)); } if (index >= sequenceNode.Count()) { throw new IndexOutOfRangeException(); } return(YamlDoc.TryMapValue(sequenceNode.ToArray()[index], out result)); }
public DynamicYaml(string yaml) : this(YamlDoc.LoadFromString(yaml)) { }
public DynamicYaml(TextReader reader) : this(YamlDoc.LoadFromTextReader(reader)) { }
public void Reload(string yaml) { Reload(YamlDoc.LoadFromString(yaml)); }
public void Reload(TextReader reader) { Reload(YamlDoc.LoadFromTextReader(reader)); }