本文整理汇总了C#中JsonObject.GetEnum方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.GetEnum方法的具体用法?C# JsonObject.GetEnum怎么用?C# JsonObject.GetEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject.GetEnum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
/// <summary>
/// Gets an album from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static FacebookAlbum Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookAlbum(obj) {
Id = obj.GetString("id"),
CanUpload = obj.GetBoolean("can_upload"),
Count = obj.GetInt32("count"),
CoverPhoto = obj.GetString("cover_photo"),
CreatedTime = obj.GetDateTime("created_time"),
Description = obj.GetString("description"),
From = obj.GetObject("from", FacebookFrom.Parse),
Link = obj.GetString("link"),
Location = obj.GetString("location"),
Name = obj.GetString("name"),
Place = obj.GetObject("place", FacebookPlace.Parse),
Privacy = obj.GetString("privacy"),
Type = obj.GetEnum<FacebookAlbumType>("type"),
UpdatedTime = obj.GetString("updated_time")
};
}
示例2: Parse
/// <summary>
/// Gets a user from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
public static FacebookUser Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookUser(obj) {
Id = obj.GetString("id"),
About = obj.GetString("about"),
Bio = obj.GetString("bio"),
Birthday = obj.GetString("birthday"),
Cover = obj.GetObject("cover", FacebookCoverPhoto.Parse),
Email = obj.GetString("email"),
FirstName = obj.GetString("first_name"),
Gender = obj.GetEnum("gender", FacebookGender.Unknown),
Hometown = obj.GetObject("hometown", FacebookObject.Parse),
IsVerified = obj.GetBoolean("is_verified"),
Languages = obj.GetArray("languages", FacebookObject.Parse) ?? new FacebookObject[0],
LastName = obj.GetString("last_name"),
Link = obj.GetString("link"),
Locale = obj.GetString("locale"),
Location = obj.GetObject("location", FacebookObject.Parse),
MiddleName = obj.GetString("middle_name"),
Name = obj.GetString("name"),
Timezone = obj.HasValue("timezone") ? obj.GetInt32("timezone") : (int?) null,
Verified = obj.GetBoolean("verified"),
Website = obj.GetString("website")
};
}
示例3: Parse
/// <summary>
/// Gets an instance of <code>SlackUser</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static SlackUser Parse(JsonObject obj) {
if (obj == null) return null;
return new SlackUser(obj) {
Id = obj.GetString("id"),
Name = obj.GetString("name"),
IsDeleted = obj.GetBoolean("deleted"),
Color = obj.GetString("color"),
RealName = obj.GetString("real_name"),
TimeZone = obj.GetString("tz"),
TimeZoneLabel = obj.GetString("tz_label"),
TimeZoneOffset = obj.GetDouble("tz_offset", TimeSpan.FromSeconds),
Profile = obj.GetObject("profile", SlackUserProfile.Parse),
IsAdmin = obj.GetBoolean("is_admin"),
IsOwner = obj.GetBoolean("is_owner"),
IsPrimaryOwner = obj.GetBoolean("is_primary_owner"),
IsRestricted = obj.GetBoolean("is_restricted"),
IsUltraRestricted = obj.GetBoolean("is_ultra_restricted"),
IsBot = obj.GetBoolean("is_bot"),
HasFiles = obj.GetBoolean("has_files"),
Has2Fa = obj.GetBoolean("has_2fa"),
Presence = obj.GetEnum("presence", SlackPresence.Unspecified)
};
}
示例4: Parse
/// <summary>
/// Gets an instance of <code>TwitterList</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static TwitterList Parse(JsonObject obj) {
if (obj == null) return null;
return new TwitterList(obj) {
Id = obj.GetInt64("id"),
Slug = obj.GetString("slug"),
Name = obj.GetString("name"),
CreatedAt = obj.GetString("created_at", TwitterUtils.ParseDateTime),
Uri = obj.GetString("uri"),
SubscriberCount = obj.GetInt32("subscriber_count"),
MemberCount = obj.GetInt32("member_count"),
Mode = obj.GetEnum<TwitterListMode>("mode"),
FullName = obj.GetString("full_name"),
Description = obj.GetString("description"),
User = obj.GetObject("user", FacebookUser.Parse),
IsFollowing = obj.GetBoolean("following")
};
}