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


C# JsonObject.GetEnum方法代码示例

本文整理汇总了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")
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:23,代码来源:FacebookAlbum.cs

示例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")
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:29,代码来源:FacebookUser.cs

示例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)
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:27,代码来源:SlackUser.cs

示例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")
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:21,代码来源:TwitterList.cs


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