Элемент пользовательского списка новостей
コード例 #1
0
ファイル: NewsUserListItem.cs プロジェクト: kadkin/vk
		/// <summary>
		/// Разобрать из json.
		/// </summary>
		/// <param name="response">Ответ сервера.</param>
		/// <returns></returns>
		internal static NewsUserListItem FromJson(VkResponse response)
		{
			var newsUserListItem = new NewsUserListItem
			{
				Id = response["id"],
				Title = response["title"],
				NoReposts = response["no_reposts"]
			};
			VkResponseArray sourceIds = response["source_ids"];
			if (sourceIds.Count == 0)
			{
				newsUserListItem.SourceIds = new List<long>();
			}
			else
			{
				newsUserListItem.SourceIds = sourceIds.ToReadOnlyCollectionOf<long>(x => x);
			}
			return newsUserListItem;
		}
コード例 #2
0
        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static NewsUserListItem FromJson(VkResponse response)
        {
            var newsUserListItem = new NewsUserListItem
            {
                Id        = response["id"],
                Title     = response["title"],
                NoReposts = response["no_reposts"]
            };
            VkResponseArray sourceIds = response["source_ids"];

            if (sourceIds.Count == 0)
            {
                newsUserListItem.SourceIds = new List <long>();
            }
            else
            {
                newsUserListItem.SourceIds = sourceIds.ToReadOnlyCollectionOf <long>(x => x);
            }
            return(newsUserListItem);
        }