Example #1
0
        public bool Add(SmartJson json)
        {
            switch (OwnType)
            {
            case JsonType.Array:
                Element.Array.Add <JsonElement>(json);
                return(true);

            default: return(false);
            }
        }
Example #2
0
        public bool Set(string key, SmartJson json)
        {
            switch (OwnType)
            {
            case JsonType.Object:
                if (key == null)
                {
                    return(false);
                }
                Element.Object[key] = json;
                return(true);

            default: return(false);
            }
        }
Example #3
0
        public bool Set(int index, SmartJson json)
        {
            if (index < 0 || index >= ChildCount)
            {
                return(false);
            }
            switch (OwnType)
            {
            case JsonType.Array:
                Element.Array[index] = json;
                return(true);

            case JsonType.Object:
                Element.Object[Element.Object.Elements.ElementAt(index).Key] = json;
                return(true);

            default: return(false);
            }
        }