当前位置: 首页>>代码示例>>C#>>正文


C# JsonObject.ContainsKey方法代码示例

本文整理汇总了C#中System.Json.JsonObject.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.ContainsKey方法的具体用法?C# JsonObject.ContainsKey怎么用?C# JsonObject.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Json.JsonObject的用法示例。


在下文中一共展示了JsonObject.ContainsKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromJson

        /// <summary>${iServer2_DataReturnOption_method_FromJson_D}</summary>
        /// <param name="jsonObject">${iServer2_DataReturnOption_method_FromJson_param_jsonObject}</param>
        /// <returns>${iServer2_DataReturnOption_method_FromJson_return}</returns>
        public static DataReturnOption FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            DataReturnOption drp = new DataReturnOption();

            if (jsonObject.ContainsKey("dataset"))
            {
                drp.Dataset = (string)jsonObject["dataset"];
            }

            if (jsonObject.ContainsKey("maxRecordCount"))
            {
                drp.MaxRecordCount = (int)jsonObject["maxRecordCount"];
            }

            if (jsonObject.ContainsKey("overwriteIfExists"))
            {
                drp.OverwriteIfExists = (bool)jsonObject["overwriteIfExists"];
            }

            if (jsonObject.ContainsKey("returnMode"))
            {
                drp.ReturnMode = (DataReturnMode)((int)jsonObject["returnMode"]);
            }
            return drp;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:33,代码来源:DataReturnOption.cs

示例2: MapPropertiesRecursive

		private static void MapPropertiesRecursive(JsonObject jObject, IDirectory directory)
		{
			foreach (var file in directory.EnumerateFiles())
			{
				var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.Name);
				if (fileNameWithoutExtension == null || fileNameWithoutExtension == IdPropertyName)
					continue;
				if (ReservedPropertyNames.Contains(fileNameWithoutExtension))
					throw new DesignDocumentAssemblerException("File name {0} is reserved.", file);

				if (jObject.ContainsKey(fileNameWithoutExtension))
					throw CreateClashingFilesException(directory, fileNameWithoutExtension);
				jObject[fileNameWithoutExtension] = ReadFile(file);
			}

			foreach (var subDirectory in directory.EnumerateDirectories())
			{
				var subDirectoryName = subDirectory.Name;

				if (ReservedPropertyNames.Contains(subDirectoryName))
					throw new DesignDocumentAssemblerException("Directory name {0} is reserved.", subDirectoryName);
				if (jObject.ContainsKey(subDirectoryName))
					throw CreateClashingFilesException(directory, subDirectoryName);

				var subObject = new JsonObject();
				jObject[subDirectoryName] = subObject;
				MapPropertiesRecursive(subObject, subDirectory);
			}
		}
开发者ID:artikh,项目名称:CouchDude.SchemeManager,代码行数:29,代码来源:DesignDocumentAssembler.cs

示例3: FromJson

        /// <summary>${IS6_ForeignDataParam_method_FromJson_D}</summary>
        /// <param name="jsonObject">${IS6_ForeignDataParam_method_FromJson_D}</param>
        /// <returns>${IS6_ForeignDataParam_method_FromJson_return}</returns>
        public static ForeignDataParam FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }
            ForeignDataParam result = new ForeignDataParam();

            result.ForeignJoinExpression = (string)jsonObject["foreignJoinExpression"];
            result.UseForeignValue = (bool)jsonObject["useForeignValue"];

            if (jsonObject.ContainsKey("foreignKeys") && jsonObject["foreignKeys"] != null && jsonObject["foreignKeys"].Count > 0)
            {
                result.ForeignKeys = new List<string>();
                for (int i = 0; i < jsonObject["foreignKeys"].Count; i++)
                {
                    result.ForeignKeys.Add((string)jsonObject["foreignKeys"][i]);
                }
            }

            if (jsonObject.ContainsKey("foreignValues") && jsonObject["foreignValues"] != null && jsonObject["foreignValues"].Count > 0)
            {
                result.ForeignValues = new List<string>();
                for (int i = 0; i < jsonObject["foreignValues"].Count; i++)
                {
                    result.ForeignValues.Add((string)jsonObject["foreignValues"][i]);
                }
            }

            return result;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:34,代码来源:ForeignDataParam.cs

示例4: FromJson

        internal static ThemeGridRange FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            ThemeGridRange result = new ThemeGridRange();

            if (jsonObject.ContainsKey("breakValues") && jsonObject["breakValues"] != null && jsonObject["breakValues"].Count > 0)
            {
                result.BreakValues = new List<double>();
                for (int i = 0; i < jsonObject["breakValues"].Count; i++)
                {
                    result.BreakValues.Add(jsonObject["breakValues"][i]);
                }

            }
            if (jsonObject.ContainsKey("displays") && jsonObject["displays"] != null && jsonObject["displays"].Count > 0)
            {
                result.Displays = new List<ServerColor>();
                for (int i = 0; i < jsonObject["displays"].Count; i++)
                {
                    result.Displays.Add(ServerColor.FromJson(jsonObject["displays"][i]));
                }

            }
            result.Caption = (string)jsonObject["caption"];
            return result;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:30,代码来源:ThemeGridRange.cs

示例5: Post

        public JsonObject Post(JsonObject contact)
        {
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            contact.ValidateStringLength("What", 1, MaxFieldLength)
                   .ValidateCustomValidator("StartDate", typeof(CustomValidator), "ValidateMeetingTime")
                   .ValidateStringLength("Where", 1, MaxFieldLength)
                   .ValidateStringLength("Description", MaxFieldLength)
                   .ValidateCustomValidator("ReminderValue", typeof(CustomValidator), "ValidateReminder")
                   .ValidateEnum("ShowMeAs", typeof(ShowMeAs))
                   .ValidateCustomValidator("Guests", typeof(CustomValidator), "ValidateGuestEmails");

            string modifyEventName = "ModifyEvent";
            if (contact.ContainsKey(modifyEventName))
            {
                contact.ValidateTypeOf<bool>(modifyEventName);
            }

            string inviteOthersName = "InviteOthers";
            if (contact.ContainsKey(inviteOthersName))
            {
                contact.ValidateTypeOf<bool>(inviteOthersName);
            }

            string seeGuestListName = "SeeGuestList";
            if (contact.ContainsKey(seeGuestListName))
            {
                contact.ValidateTypeOf<bool>(seeGuestListName);
            }

            return new JsonObject();
        }
开发者ID:nuxleus,项目名称:WCFWeb,代码行数:35,代码来源:CalendarResource.cs

示例6: FromJson

        internal static SmMapServiceInfo FromJson(JsonObject json)
        {
            if (json == null) return null;

            if (!json.ContainsKey("name") || !json.ContainsKey("bounds")) return null;

            return new SmMapServiceInfo
            {
                ViewBounds = JsonHelper.ToRectangle2D((JsonObject)json["viewBounds"]),
                CoordUnit = (Unit)Enum.Parse(typeof(Unit), (string)json["coordUnit"], true),
                Bounds = JsonHelper.ToRectangle2D((JsonObject)json["bounds"]),
                PrjCoordSys = PrjCoordSys.FromJson((JsonObject)json["prjCoordSys"]),
                Scale = (double)json["scale"],
                Viewer = JsonHelper.ToRect((JsonObject)json["viewer"])
            };
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:16,代码来源:SmMapServiceInfo.cs

示例7: FromJson

 internal static JoinItem FromJson(JsonObject json)
 {
     if (json == null) return null;
     JoinItem item = new JoinItem();
     if (json.ContainsKey("foreignTableName"))
     {
         item.ForeignTableName = json["foreignTableName"];
     }
     if (json.ContainsKey("joinFilter"))
     {
         item.JoinFilter = json["joinFilter"];
     }
     if (json.ContainsKey("joinType") && !string.IsNullOrEmpty(json["joinType"]))
     {
         item.JoinType = (JoinType)Enum.Parse(typeof(JoinType), json["joinType"], true);
     }
     return item;
 }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:18,代码来源:JoinItem.cs

示例8: FromJson

        /// <summary>${iServerJava6R_ResultSet_method_fromJson_D}</summary>
        /// <returns>${iServerJava6R_ResultSet_method_fromJson_return}</returns>
        /// <param name="json">${iServerJava6R_ResultSet_method_fromJson_param_jsonObject}</param>
        public static QueryResult FromJson(JsonObject json)
        {
            if (json == null)
            {
                return null;
            }

            QueryResult result = new QueryResult();

            if (json.ContainsKey("totalCount") && json.ContainsKey("currentCount") && json.ContainsKey("customResponse") && json.ContainsKey("recordsets"))
            {
                result.TotalCount = (int)json["totalCount"];

                if ((int)json["totalCount"] == 0)
                {
                    return null;
                }

                result.CurrentCount = (int)json["currentCount"];
                result.CustomResponse = (string)json["customResponse"];

                JsonArray recordsets = (JsonArray)json["recordsets"];
                if (recordsets != null && recordsets.Count > 0)
                {
                    result.Recordsets = new List<Recordset>();

                    for (int i = 0; i < recordsets.Count; i++)
                    {
                        result.Recordsets.Add(Recordset.FromJson((JsonObject)recordsets[i]));
                    }
                }
                return result;
            }
            else if (json.ContainsKey("succeed") && json.ContainsKey("newResourceLocation"))
            {
                ResourceInfo info = new ResourceInfo();
                info.Succeed = (bool)json["succeed"];
                info.NewResourceLocation = (string)json["newResourceLocation"];
                info.NewResourceID = (string)json["newResourceID"];
                result.ResourceInfo = info;
                return result;
            }
            return null;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:47,代码来源:QueryResult.cs

示例9: JsonToSimilarImage

		public static SimilarImage JsonToSimilarImage(JsonObject obj)
		{			
			var keyword = new SimilarImage()
			{				
				Image = ImagesService.JsonToImage((JsonObject)obj["Image"]),
				Keyword = obj.ContainsKey("Keyword")? obj["Keyword"].ToString().Replace("\"","") : null,
			};
			
			return keyword;
		}		
开发者ID:21Off,项目名称:21Off,代码行数:10,代码来源:KeywordsService.cs

示例10: FromJson

        /// <summary>${IS6_Record_method_FromJson_D}</summary>
        /// <param name="jsonObject">${IS6_Record_method_FromJson_param_jsonObject}</param>
        /// <returns>${IS6_Record_method_FromJson_return}</returns>
        public static Record FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            Record record = new Record();

            if (jsonObject.ContainsKey("bounds") && jsonObject["bounds"] != null)
            {
                double mbMinX = (double)jsonObject["bounds"]["leftBottom"]["x"];
                double mbMinY = (double)jsonObject["bounds"]["leftBottom"]["y"];
                double mbMaxX = (double)jsonObject["bounds"]["rightTop"]["x"];
                double mbMaxY = (double)jsonObject["bounds"]["rightTop"]["y"];
                record.Bounds = new Rectangle2D(mbMinX, mbMinY, mbMaxX, mbMaxY);
            }
            else
            {
                record.Bounds = Rectangle2D.Empty;
            }

            if (jsonObject.ContainsKey("center") && jsonObject["center"] != null)
            {
                record.Center = JsonHelper.ToPoint2D((JsonObject)jsonObject["center"]);
            }
            else
            {
                record.Center = Point2D.Empty;
            }

            if (jsonObject.ContainsKey("shape") && jsonObject["shape"] != null)
            {
                record.Shape = ServerGeometry.FromJson((JsonObject)jsonObject["shape"]);
            }

            if (jsonObject.ContainsKey("fieldValues") && jsonObject["fieldValues"] != null)
            {
                record.FieldValues = JsonHelper.ToStringList((JsonArray)jsonObject["fieldValues"]);
            }
            return record;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:45,代码来源:Record.cs

示例11: FromJson

        internal static ChartAttributeSpec FromJson(JsonObject json)
        {
            if (json == null || !json.ContainsKey("code"))
            {
                return null;
            }
            ChartAttributeSpec attrib = new ChartAttributeSpec();

            attrib.Code = (int)json["code"];
            attrib.Required = (int)json["required"];

            return attrib;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:13,代码来源:ChartAttributeSpec.cs

示例12: SymbolFromJson

        /// <summary>
        /// Creates a symbol compatible with Application Framework from JSON object
        /// </summary>
        /// <param name="jsonObject">JSON object defining a symbol</param>
        /// <returns>Symbol</returns>
        public static Symbol SymbolFromJson(JsonObject jsonObject)
        {
            Symbol symb = null;
            if (jsonObject != null)
            {
                string symbType = jsonObject["type"];
                if (!string.IsNullOrEmpty(symbType))
                {
                    switch (symbType)
                    {
                        case "esriPMS":// REST defined PictureMarkerSymbol --> output: ImageFillSymbol 
                            #region
                            ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol imgsymb = new ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol();
                            double size = 64; // standard size of images used for Viewer symbols
                            if (jsonObject.ContainsKey("width"))
                                size = jsonObject["width"];
                            imgsymb.Size = size;
                            if (jsonObject.ContainsKey("xoffset"))
                                imgsymb.OriginX = (size /2 + jsonObject["xoffset"]) / size;
                            if (jsonObject.ContainsKey("yoffset"))
                                imgsymb.OriginY = (size / 2 + jsonObject["yoffset"]) / size;
                            if (jsonObject.ContainsKey("imageData"))
                                imgsymb.ImageData = jsonObject["imageData"];
                            else if (jsonObject.ContainsKey("url"))
                                imgsymb.Source = jsonObject["url"];

                            symb = imgsymb;
                            break;
                            #endregion
                        default:
                            // all other REST defined cases
                            symb = Symbol.FromJson(jsonObject.ToString());
                            break;
                    }
                }
            }
            return symb;
        }
开发者ID:konglingjie,项目名称:arcgis-viewer-silverlight,代码行数:43,代码来源:SymbolJsonHelper.cs

示例13: FromJson

        /// <summary>${IS6_ThemeRange_method_FromJson_D}</summary>
        /// <returns>${IS6_ThemeRange_method_FromJson_return}</returns>
        /// <param name="jsonObject">${IS6_ThemeRange_method_FromJson_param_jsonObject}</param>
        public static ThemeRange FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }

            ThemeRange result = new ThemeRange
            {
                Caption = (string)jsonObject["caption"],
                Filter = (string)jsonObject["filter"],
                MaxScale = (double)jsonObject["maxScale"],
                MinScale = (double)jsonObject["minScale"],
                ForeignDataParam = ForeignDataParam.FromJson((JsonObject)jsonObject["foreignDataParam"])
            };

            if (jsonObject.ContainsKey("breakValues") && jsonObject["breakValues"] != null && jsonObject["breakValues"].Count > 0)
            {
                result.BreakValues = new List<double>();
                for (int i = 0; i < jsonObject["breakValues"].Count; i++)
                {
                    result.BreakValues.Add((double)jsonObject["breakValues"][i]);
                }
            }

            if (jsonObject.ContainsKey("displays") && jsonObject["displays"] != null && jsonObject["displays"].Count > 0)
            {
                result.Displays = new List<ServerStyle>();
                for (int i = 0; i < jsonObject["displays"].Count; i++)
                {
                    result.Displays.Add(ServerStyle.FromJson((JsonObject)jsonObject["displays"][i]));
                }
            }

            result.Expression = (string)jsonObject["expression"];

            return result;
        }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:41,代码来源:ThemeRange.cs

示例14: SymbolFromJson

        /// <summary>
        /// Creates a symbol compatible with Application Framework from JSON object
        /// </summary>
        /// <param name="jsonObject">JSON object defining a symbol</param>
        /// <returns>Symbol</returns>
        public static Symbol SymbolFromJson(JsonObject jsonObject)
        {
            Symbol symb = null;
            if (jsonObject != null)
            {
                string symbType = jsonObject["type"];
                if (!string.IsNullOrEmpty(symbType))
                {
                    switch (symbType)
                    {
                        case "esriPMS":// REST defined PictureMarkerSymbol --> output: ImageFillSymbol 
                            #region
                            ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol imgsymb = new ESRI.ArcGIS.Mapping.Core.Symbols.ImageFillSymbol();
                            double size = 64; // standard size of images used for Viewer symbols
                            if (jsonObject.ContainsKey("width") || jsonObject.ContainsKey("height"))
                            {
                                // Get the greater of the width or height, converting from points to pixels in the process
                                var pointsToPixelsFactor = 4d / 3d;
                                var width = jsonObject.ContainsKey("width") ? jsonObject["width"] * pointsToPixelsFactor : 0;
                                var height = jsonObject.ContainsKey("height") ? jsonObject["height"] * pointsToPixelsFactor : 0;
                                size = width > height ? width : height;
                            }
                            imgsymb.Size = size;
                            if (jsonObject.ContainsKey("xoffset"))
                                imgsymb.OriginX = (size /2 + jsonObject["xoffset"]) / size;
                            if (jsonObject.ContainsKey("yoffset"))
                                imgsymb.OriginY = (size / 2 + jsonObject["yoffset"]) / size;
                            if (jsonObject.ContainsKey("imageData"))
                                imgsymb.ImageData = jsonObject["imageData"];
                            else if (jsonObject.ContainsKey("url"))
                                imgsymb.Source = jsonObject["url"];

                            var fill = imgsymb.Fill as ImageBrush;
                            if (fill != null)
                                fill.Stretch = Stretch.Uniform;

                            symb = imgsymb;
                            break;
                            #endregion
                        default:
                            // all other REST defined cases
                            symb = Symbol.FromJson(jsonObject.ToString());
                            break;
                    }
                }
            }
            return symb;
        }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:53,代码来源:SymbolJsonHelper.cs

示例15: GetIntProperty

        private static int? GetIntProperty(JsonObject jsonObject, string propertyName)
        {
            if (!jsonObject.ContainsKey(propertyName))
                return null;
            var value = jsonObject[propertyName] as JsonPrimitive;
            if (value != null)
            {
                var intValue = value.Value as int?;
                if (intValue != null)
                    return value.Value as int?;
            }

            throw new ParseException("Response property {0} should be integer value", propertyName);
        }
开发者ID:artikh,项目名称:CouchDude,代码行数:14,代码来源:QueryResultParserBase.cs


注:本文中的System.Json.JsonObject.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。