SuperMap.Web.iServerJava6R.ThemeOffset.ToJson C# (CSharp) Méthode

ToJson() static private méthode

static private ToJson ( ThemeOffset offsetTheme ) : string
offsetTheme ThemeOffset
Résultat string
        internal static string ToJson(ThemeOffset offsetTheme)
        {
            string json = "";

            List<string> list = new List<string>();
            list.Add(string.Format("\"offsetFixed\":{0}", offsetTheme.OffsetFixed.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()));

            if (!string.IsNullOrEmpty(offsetTheme.OffsetX))
            {
                list.Add(string.Format("\"offsetX\":\"{0}\"", offsetTheme.OffsetX));
            }
            else
            {
                list.Add("\"offsetX\":\"\"");
            }

            if (!string.IsNullOrEmpty(offsetTheme.OffsetY))
            {
                list.Add(string.Format("\"offsetY\":\"{0}\"", offsetTheme.OffsetY));
            }
            else
            {
                list.Add("\"offsetY\":\"\"");
            }

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