本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}