SuperMap.Web.iServerJava6R.ThemeGridRangeItem.ToJson C# (CSharp) Method

ToJson() static private method

static private ToJson ( ThemeGridRangeItem themeGridRangeItem ) : string
themeGridRangeItem ThemeGridRangeItem
return string
        internal static string ToJson(ThemeGridRangeItem themeGridRangeItem)
        {
            string json = "{";
            List<string> list = new List<string>();

            if (!string.IsNullOrEmpty(themeGridRangeItem.Caption))
            {
                list.Add(string.Format("\"caption\":\"{0}\"", themeGridRangeItem.Caption));
            }
            else
            {
                list.Add("\"caption\":\"\"");
            }

            if (themeGridRangeItem.Color != null)
            {
                list.Add(string.Format("\"color\":{0}", ServerColor.ToJson(themeGridRangeItem.Color)));
            }
            else
            {
                list.Add(string.Format("\"color\":{0}", ServerColor.ToJson(new ServerColor())));
            }

            list.Add(string.Format("\"visible\":{0}", themeGridRangeItem.Visible.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()));

            list.Add(string.Format("\"end\":{0}", themeGridRangeItem.End.ToString(System.Globalization.CultureInfo.InvariantCulture)));

            list.Add(string.Format("\"start\":{0}", themeGridRangeItem.Start.ToString(System.Globalization.CultureInfo.InvariantCulture)));

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }