コード例 #1
0
        public bool IsModel(string key)
        {
            if (!isModel)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(key))
            {
                return(false);
            }

            foreach (string subjson in base._GetCollection(this.rawjson))
            {
                CommonJsonModel model = new CommonJsonModel(subjson);

                if (!model.IsValue())
                {
                    continue;
                }

                if (model.Key == key)
                {
                    CommonJsonModel submodel = new CommonJsonModel(model.Value);

                    return(submodel.IsModel());
                }
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// 当模型是对象,返回拥有的key
        /// </summary>
        /// <returns></returns>
        public List <string> GetKeys()
        {
            if (!isModel)
            {
                return(null);
            }

            List <string> list = new List <string>();

            foreach (string subjson in base._GetCollection(this.rawjson))
            {
                string key = new CommonJsonModel(subjson).Key;

                if (!string.IsNullOrEmpty(key))
                {
                    list.Add(key);
                }
            }

            return(list);
        }