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


C# JsonArray.ElementAt方法代码示例

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


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

示例1: ParseResults

        private Dictionary<long, FriendsInfoStruct> ParseResults(JsonArray ResultsArray)
        {
            Dictionary<long, FriendsInfoStruct> FriendsInfo = new Dictionary<long, FriendsInfoStruct>();

            JsonObject FriendsQuery = (JsonObject)ResultsArray.ElementAt(2);

            for (int i = 1; i < FriendsQuery.Count; i++)
            {
                JsonArray Friends = (JsonArray)FriendsQuery.ElementAt(i).Value;

                for (int j = 0; j < Friends.Count; j++)
                {
                    JsonObject FriendJson = (JsonObject)Friends.ElementAt(j);

                    string is_app_user = "false";
                    string name = "";
                    string pic_big = "";
                    string profile_update_time = "0";
                    string sex = "";
                    string uid = "0";
                    string wall_count = "0";
                    string pic_square = "";
                    string profile_url = "";

                    //Extended 1
                    string birthday_date = "";
                    string online_presence = "offline";            //active, idle, offline, or error
                    string relationship_status = "";
                    string significant_other_id = "0";

                    //Extended 2
                    string status_message = "";
                    string status_time = "";

                    string current_location = "";
                    string website = "";
                    string third_party_id = "";

                    #region Standard
                    if (FriendJson.ContainsKey("is_app_user"))
                        if (FriendJson["is_app_user"] != null)
                            is_app_user = FriendJson["is_app_user"].ToString();

                    if (FriendJson.ContainsKey("name"))
                        if (FriendJson["name"] != null)
                            name = FriendJson["name"].ToString();

                    if (FriendJson.ContainsKey("pic_big"))
                        if (FriendJson["pic_big"] != null)
                            pic_big = FriendJson["pic_big"].ToString();

                    if (FriendJson.ContainsKey("profile_update_time"))
                        if (FriendJson["profile_update_time"] != null)
                            profile_update_time = FriendJson["profile_update_time"].ToString();

                    if (FriendJson.ContainsKey("sex"))
                        if (FriendJson["sex"] != null)
                            sex = FriendJson["sex"].ToString();

                    if (FriendJson.ContainsKey("uid"))
                        if (FriendJson["uid"] != null)
                            uid = FriendJson["uid"].ToString();

                    if (FriendJson.ContainsKey("wall_count"))
                        if (FriendJson["wall_count"] != null)
                            wall_count = FriendJson["wall_count"].ToString();

                    if (FriendJson.ContainsKey("pic_square"))
                        if (FriendJson["pic_square"] != null)
                            pic_square = FriendJson["pic_square"].ToString();

                    if (FriendJson.ContainsKey("profile_url"))
                        if (FriendJson["profile_url"] != null)
                            profile_url = FriendJson["profile_url"].ToString();
                    #endregion

                    #region Extended
                    if (FriendJson.ContainsKey("birthday_date"))
                        if (FriendJson["birthday_date"] != null)
                            birthday_date = FriendJson["birthday_date"].ToString();

                    if (FriendJson.ContainsKey("online_presence"))
                        if (FriendJson["online_presence"] != null)
                            online_presence = FriendJson["online_presence"].ToString();

                    if (FriendJson.ContainsKey("relationship_status"))
                        if (FriendJson["relationship_status"] != null)
                            relationship_status = FriendJson["relationship_status"].ToString();

                    if (FriendJson.ContainsKey("significant_other_id"))
                        if (FriendJson["significant_other_id"] != null)
                            significant_other_id = FriendJson["significant_other_id"].ToString();

                    if (FriendJson.ContainsKey("status"))
                        if (FriendJson["status"] != null)
                        {
                            var Status = FriendJson["status"] as JsonObject;

                            if (Status[0] != null)
                            {
//.........这里部分代码省略.........
开发者ID:LimeyJohnson,项目名称:RandomProjects,代码行数:101,代码来源:GetFriendsInfo.cs


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