SuperMap.WinRT.REST.ThemeGraduatedSymbolStyle.ToJson C# (CSharp) Method

ToJson() static private method

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

            if (valueSection.PositiveStyle != null)
            {
                list.Add(string.Format("\"positiveStyle\":{0}", ServerStyle.ToJson(valueSection.PositiveStyle)));
            }
            else
            {
                list.Add(string.Format("\"positiveStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            if (valueSection.NegativeStyle != null)
            {
                list.Add(string.Format("\"negativeStyle\":{0}", ServerStyle.ToJson(valueSection.NegativeStyle)));
            }
            else
            {
                list.Add(string.Format("\"negativeStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            if (valueSection.ZeroStyle != null)
            {
                list.Add(string.Format("\"zeroStyle\":{0}", ServerStyle.ToJson(valueSection.ZeroStyle)));
            }
            else
            {
                list.Add(string.Format("\"zeroStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            if (valueSection.ZeroDisplayed)
            {
                list.Add(string.Format("\"zeroDisplayed\":{0}", valueSection.ZeroDisplayed.ToString().ToLower()));
            }

            if (valueSection.NegativeDisplayed)
            {
                list.Add(string.Format("\"negativeDisplayed\":{0}", valueSection.NegativeDisplayed.ToString().ToLower()));
            }
            json = string.Join(",", list.ToArray());
            return json;
        }