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

ToJson() static private method

static private ToJson ( ThemeUniqueItem item ) : string
item ThemeUniqueItem
return string
        internal static string ToJson(ThemeUniqueItem item)
        {
            string json = "{";

            List<string> list = new List<string>();
            if (!string.IsNullOrEmpty(item.Caption))
            {
                list.Add(string.Format("\"caption\":\"{0}\"", item.Caption));
            }
            else
            {
                list.Add("\"caption\":\"\"");
            }

            //默认值这边儿是个问题,又不要判断呢?
            list.Add(string.Format("\"visible\":{0}", item.Visible.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()));

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

            if (!string.IsNullOrEmpty(item.Unique))
            {
                list.Add(string.Format("\"unique\":\"{0}\"", item.Unique));
            }
            else
            {
                list.Add("\"unique\":\"\"");
            }

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