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


C# JsonValue.ContainsName方法代码示例

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


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

示例1: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Comment comment = null;
			if ( json != null && !json.IsNull )
			{
				comment = new Comment();
				comment.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id"     ) : String.Empty;
				comment.Message     = json.ContainsName("message"     ) ? json.GetValue<string>("message") : String.Empty;
				comment.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;

				comment.From        = mapper.Deserialize<Reference      >(json.GetValue("from" ));
				// 04/12/2012 Paul.  Likes is a connection object, so make sure that this is not the same likes property value. 
				// 04/15/2012 Paul.  Likes can be a number or an array. 
				JsonValue jsonLikes = json.GetValue("likes");
				if ( jsonLikes != null && !jsonLikes.IsNull )
				{
					if ( jsonLikes.IsArray )
					{
						comment.Likes       = mapper.Deserialize<List<Reference>>(jsonLikes);
						comment.LikesCount  = (comment.Likes != null) ? comment.Likes.Count : 0;
					}
					else if ( jsonLikes.IsNumber )
					{
						comment.LikesCount = jsonLikes.GetValue<int>();
					}
				}
			}
			return comment;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:29,代码来源:CommentDeserializer.cs

示例2: Deserialize

        public virtual object Deserialize(JsonValue json, JsonMapper mapper)
        {
            PaginatedResult paginatedResult = this.CreatePaginatedResult();

            paginatedResult.Total = json.GetValue<int>("_total");
            paginatedResult.Start = json.ContainsName("_start") ? json.GetValue<int>("_start") : 0;
            paginatedResult.Count = json.ContainsName("_count") ? json.GetValue<int>("_count") : paginatedResult.Total;            

            return paginatedResult;
        }
开发者ID:poundingCode,项目名称:spring-net-social-linkedin,代码行数:10,代码来源:PaginatedResultDeserializer.cs

示例3: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Reference reference = null;
			if ( json != null && !json.IsNull )
			{
				reference = new Reference();
				reference.ID   = json.ContainsName("id"  ) ? json.GetValue<string>("id"  ) : String.Empty;
				reference.Name = json.ContainsName("name") ? json.GetValue<string>("name") : String.Empty;
			}
			return reference;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:11,代码来源:ReferenceDeserializer.cs

示例4: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			FamilyMember family = null;
			if ( json != null && !json.IsNull )
			{
				family = new FamilyMember();
				family.ID           = json.ContainsName("id"          ) ? json.GetValue<string>("id"          ) : String.Empty;
				family.Name         = json.ContainsName("name"        ) ? json.GetValue<string>("name"        ) : String.Empty;
				family.Relationship = json.ContainsName("relationship") ? json.GetValue<string>("relationship") : String.Empty;
			}
			return family;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:12,代码来源:FamilyMemberDeserializer.cs

示例5: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Photo.Image image = null;
			if ( json != null && !json.IsNull )
			{
				image = new Photo.Image();
				image.Source = json.ContainsName("source") ? json.GetValue<string>("source") : String.Empty;
				image.Width  = json.ContainsName("width" ) ? json.GetValue<int   >("width" ) : 0;
				image.Height = json.ContainsName("height") ? json.GetValue<int   >("height") : 0;
			}
			return image;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:12,代码来源:ImageDeserializer.cs

示例6: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			EventInvitee album = null;
			if ( json != null && !json.IsNull )
			{
				album = new EventInvitee();
				album.ID         = json.ContainsName("id"  ) ? json.GetValue<string>("id"  ) : String.Empty;
				album.Name       = json.ContainsName("name") ? json.GetValue<string>("name") : String.Empty;
				album.RsvpStatus = RsvpStatusDeserializer(json.GetValue("rsvp_status"));
			}
			return album;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:12,代码来源:EventInviteeDeserializer.cs

示例7: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			GroupMemberReference group = null;
			if ( json != null && !json.IsNull )
			{
				group = new GroupMemberReference();
				group.ID            = json.ContainsName("id"           ) ? json.GetValue<string>("id"           ) : String.Empty;
				group.Name          = json.ContainsName("name"         ) ? json.GetValue<string>("name"         ) : String.Empty;
				group.Administrator = json.ContainsName("administrator") ? json.GetValue<bool  >("administrator") : false;
			}
			return group;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:12,代码来源:GroupMemberReferenceDeserializer.cs

示例8: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			StoryTag video = null;
			if ( json != null && !json.IsNull )
			{
				video = new StoryTag();
				video.ID     = json.ContainsName("id"    ) ? json.GetValue<string>("id"    ) : String.Empty;
				video.Name   = json.ContainsName("name"  ) ? json.GetValue<string>("name"  ) : String.Empty;
				video.Offset = json.ContainsName("offset") ? json.GetValue<int   >("offset") : 0;
				video.Length = json.ContainsName("length") ? json.GetValue<int   >("length") : 0;
			}
			return video;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:13,代码来源:StoryTagDeserializer.cs

示例9: DeserializeLinkedInDate

 private static LinkedInDate DeserializeLinkedInDate(JsonValue json)
 {
     if (json != null)
     {
         return new LinkedInDate()
         {
             Year = json.ContainsName("year") ? json.GetValue<int?>("year") : null,
             Month = json.ContainsName("month") ? json.GetValue<int?>("month") : null,
             Day = json.ContainsName("day") ? json.GetValue<int?>("day") : null
         };
     }
     return null;
 }
开发者ID:erijss,项目名称:spring-net-social-linkedin,代码行数:13,代码来源:LinkedInFullProfileDeserializer.cs

示例10: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Account account = null;
			if ( json != null && !json.IsNull )
			{
				account = new Account();
				account.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id"          ) : String.Empty;
				account.Name        = json.ContainsName("name"        ) ? json.GetValue<string>("name"        ) : String.Empty;
				account.Category    = json.ContainsName("category"    ) ? json.GetValue<string>("category"    ) : String.Empty;
				account.AccessToken = json.ContainsName("access_token") ? json.GetValue<string>("access_token") : String.Empty;
			}
			return account;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:13,代码来源:AccountDeserializer.cs

示例11: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			WorkEntry entry = null;
			if ( json != null && !json.IsNull )
			{
				entry = new WorkEntry();
				entry.StartDate = json.ContainsName("start_date") ? json.GetValue<string>("start_date") : String.Empty;
				entry.EndDate   = json.ContainsName("end_date"  ) ? json.GetValue<string>("end_date"  ) : String.Empty;
				
				entry.Employer  = mapper.Deserialize<Reference>(json.GetValue("employer"));
			}
			return entry;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:13,代码来源:WorkEntryDeserializer.cs

示例12: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Invitation invite = null;
			if ( json != null && !json.IsNull )
			{
				invite = new Invitation();
				invite.EventId    = json.ContainsName("id"        ) ? json.GetValue<string>("id"  ) : String.Empty;
				invite.Name       = json.ContainsName("name"      ) ? json.GetValue<string>("name") : String.Empty;
				invite.StartTime  = json.ContainsName("start_time") ? JsonUtils.ToDateTime(json.GetValue<string>("start_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				invite.EndTime    = json.ContainsName("end_time"  ) ? JsonUtils.ToDateTime(json.GetValue<string>("end_time"  ), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				invite.RsvpStatus = RsvpStatusDeserializer(json.GetValue("rsvp_status"));
			}
			return invite;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:14,代码来源:InvitationDeserializer.cs

示例13: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			StatusPost post = null;
			if ( json != null && !json.IsNull )
			{
				post = new StatusPost();
				post.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id") : String.Empty;
				post.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				post.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				
				post.From        = mapper.Deserialize<Reference>(json.GetValue("from"));
			}
			return post;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:14,代码来源:StatusPostDeserializer.cs

示例14: Deserialize

 public override object Deserialize(JsonValue json, JsonMapper mapper)
 {
     JsonValue peopleJson = json.ContainsName("people") ? json.GetValue("people") : json;
     LinkedInProfiles profiles = (LinkedInProfiles)base.Deserialize(peopleJson, mapper);
     profiles.Profiles = mapper.Deserialize<IList<LinkedInProfile>>(peopleJson);
     return profiles;
 }
开发者ID:pkdevbox,项目名称:spring-net-social-linkedin,代码行数:7,代码来源:LinkedInProfilesDeserializer.cs

示例15: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Question question = null;
			if ( json != null && !json.IsNull )
			{
				question = new Question();
				question.ID          = json.ContainsName("id"          ) ? json.GetValue<string>("id"      ) : String.Empty;
				question.Text        = json.ContainsName("question"    ) ? json.GetValue<string>("question") : String.Empty;
				question.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;
				question.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue;

				question.From        = mapper.Deserialize<Reference           >(json.GetValue("from"   ));
				question.Options     = mapper.Deserialize<List<QuestionOption>>(json.GetValue("options"));
			}
			return question;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:16,代码来源:QuestionDeserializer.cs


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