ToString() публичный Метод

public ToString ( ) : string
Результат string
Пример #1
0
		static object GetValue(YamlNode yamlNode)
		{
			if (yamlNode is YamlMappingNode)
				return GetMappingValue((YamlMappingNode)yamlNode);
			
			if (yamlNode is YamlSequenceNode)
				return GetSequenceValue((YamlSequenceNode)yamlNode);
			
			return yamlNode.ToString();
		}
        private static IEnumerable<string> GetYamlNodeValues(YamlNode value)
        {
            var retVal = new List<String>();
            var list = value as YamlSequenceNode;

            if (list != null)
            {
                foreach (var entry in list.Children)
                {
                    var node = entry as YamlScalarNode;
                    if (node != null)
                    {
                        retVal.Add(node.Value);
                    }
                }
            }
            else
            {
                retVal.Add(value.ToString());
            }

            return retVal;
        }
Пример #3
0
 static List<KeyPressDefinition> KeyPressDefinitions(YamlNode keyCombo)
 {
     return keyCombo.ToString()
         .Split(',')
         .Select(GetKeyPressDefintion)
         .Where(definition => definition != null)
         .ToList();
 }
Пример #4
0
        private static object ParseYamlNodeValue(YamlNode valueNode)
        {
            if (valueNode is YamlScalarNode)
            {
                return ParseStringValue(((YamlScalarNode)valueNode).Value);
            }
            else if (valueNode is YamlMappingNode)
            {
                Dictionary<string, object> hash = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
                var mappingNode = valueNode as YamlMappingNode;
                foreach (var keyNode in mappingNode.Children.Keys)
                {
                    var scalarKeyNode = keyNode as YamlScalarNode;
                    if (scalarKeyNode == null)
                    {
                        // ignore
                        continue;
                    }

                    hash[scalarKeyNode.Value] = ParseYamlNodeValue(mappingNode.Children[keyNode]);
                }

                return hash;
            }
            else if (valueNode is YamlSequenceNode)
            {
                var items = new List<object>();
                foreach (var itemNode in ((YamlSequenceNode)valueNode))
                {
                    items.Add(ParseYamlNodeValue(itemNode));
                }
                return items;
            }
            else
            {
                throw new Exception("Unknown node: " + valueNode.ToString());
            }
        }
Пример #5
0
 // string
 public string Str()
 {
     return(node.ToString());
 }