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

ToJson() static private method

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

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

            if (themeRangeItem.Style != null)
            {
                list.Add(string.Format("\"style\":{0}", ServerStyle.ToJson(themeRangeItem.Style)));
            }
            else
            {
                list.Add(string.Format("\"style\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

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

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

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

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