/// <summary> /// Разобрать из json. /// </summary> /// <param name="response">Ответ сервера.</param> /// <returns></returns> internal static NewsSearchResult FromJson(VkResponse response) { var newsSearchResult = new NewsSearchResult { Id = response["id"], OwnerId = response["owner_id"], FromId = response["from_id"], Date = response["date"], Text = response["text"], Comments = response["comments"], Likes = response["likes"], Attachments = response["attachments"].ToReadOnlyCollectionOf <Attachment>(x => x), Geo = response["geo"] }; return(newsSearchResult); }
} //Будет иметь значение null, кроме случаев при "post_type": "reply" /// <summary> /// Разобрать из json. /// </summary> /// <param name="response"> Ответ сервера. </param> /// <returns> </returns> public static NewsSearchResult FromJson(VkResponse response) { var newsSearchResult = new NewsSearchResult { Id = response[key : "id"] , OwnerId = response[key : "owner_id"] , FromId = response[key : "from_id"] , Date = response[key : "date"] , Text = response[key : "text"] , Comments = response[key : "comments"] , Likes = response[key : "likes"] , Attachments = response[key : "attachments"].ToReadOnlyCollectionOf <Attachment>(selector : x => x) , Geo = response[key : "geo"] , SignerId = response[key : "signer_id"] , PostType = response[key : "post_type"] , PostId = response[key : "post_id"] // }; return(newsSearchResult); }
/// <summary> /// Разобрать из json. /// </summary> /// <param name="response">Ответ сервера.</param> /// <returns></returns> internal static NewsSearchResult FromJson(VkResponse response) { var newsSearchResult = new NewsSearchResult { Id = response["id"], OwnerId = response["owner_id"], FromId = response["from_id"], Date = response["date"], Text = response["text"], Comments = response["comments"], Likes = response["likes"], Attachments = response["attachments"].ToReadOnlyCollectionOf<Attachment>(x => x), Geo = response["geo"], SignerId = response["signer_id"], PostType = response["post_type"] }; return newsSearchResult; }