ToString() private method

private ToString ( string indent ) : string
indent string
return string
示例#1
0
        public static JProperty UpdateProperty(JObject jsonObject, WValueExpression fieldName, WValueExpression fieldValue)
        {
            string key = fieldName.Value;

            //
            // Special treat when fieldValue indicates null (that is, to remove a property)
            // NOTE: fieldValue itself != null
            //
            if (!fieldValue.SingleQuoted && fieldValue.Value.Equals("null", StringComparison.OrdinalIgnoreCase))
            {
                jsonObject.Property(key)?.Remove();
                return(null);
            }

            //
            // JSON requires a lower case string if it is a boolean value
            //
            bool boolValue;

            if (!fieldValue.SingleQuoted && bool.TryParse(fieldValue.Value, out boolValue))
            {
                jsonObject[key] = (JToken)boolValue;
            }
            else
            {
                jsonObject[key] = JToken.Parse(fieldValue.ToString());
            }
            return(jsonObject.Property(key));
        }
        public static JValue ToJValue(this WValueExpression expr)
        {
            //
            // Special treat when fieldValue indicates null (that is, to remove a property)
            // NOTE: fieldValue itself != null
            //
            if (!expr.SingleQuoted && expr.Value.Equals("null", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            //
            // JSON requires a lower case string if it is a boolean value
            //
            bool boolValue;

            if (!expr.SingleQuoted && bool.TryParse(expr.Value, out boolValue))
            {
                return((JValue)boolValue);
            }
            else if (expr.SingleQuoted)
            {
                return((JValue)expr.Value);  // String value
            }
            else
            {
                return((JValue)JToken.Parse(expr.ToString()));
            }
        }
示例#3
0
        public override void Visit(WValueExpression node)
        {
            string value = node.ToString("");

            // TODO: double check, how to use boolean type in database?
//            if (value == "true" || value == "false")
//            {
//                value = $"'{value}'";
//            }
            this.dfsStack.Push(value);
        }
示例#4
0
        public static JValue ToJValue(this WValueExpression expr)
        {
            //
            // JSON requires a lower case string if it is a boolean value
            //
            bool boolValue;

            if (!expr.SingleQuoted && bool.TryParse(expr.Value, out boolValue))
            {
                return((JValue)boolValue);
            }
            else if (expr.SingleQuoted)
            {
                return((JValue)expr.Value);  // String value
            }
            else
            {
                return((JValue)JToken.Parse(expr.ToString()));
            }
        }
 public override void Visit(WValueExpression node)
 {
     this.dfsStack.Push(node.ToString(""));
 }