VkNet.Model.Attachments.Attachment.FromJson C# (CSharp) Method

FromJson() public static method

Разобрать из json.
public static FromJson ( VkResponse response ) : Attachment
response VkNet.Utils.VkResponse Ответ сервера.
return Attachment
        public static Attachment FromJson(VkResponse response)
        {
            var attachment = new Attachment();

            string type = response["type"];
            switch (type)
            {
                case "photo":
                case "posted_photo":
                    {
                        attachment.Type = typeof(Photo);
                        attachment.Photo = response[type];
                        break;
                    }
                case "video":
                    {
                        attachment.Type = typeof(Video);
                        attachment.Video = response["video"];
                        break;
                    }
                case "audio":
                    {
                        attachment.Type = typeof(Audio);
                        attachment.Audio = response["audio"];
                        break;
                    }
                case "doc":
                    {
                        attachment.Type = typeof(Document);
                        attachment.Document = response["doc"];
                        break;
                    }
                case "graffiti":
                    {
                        attachment.Type = typeof(Graffiti);
                        attachment.Graffiti = response["graffiti"];
                        break;
                    }
                case "link":
                    {
                        attachment.Type = typeof(Link);
                        attachment.Link = response["link"];
                        break;
                    }
                case "note":
                    {
                        attachment.Type = typeof(Note);
                        attachment.Note = response["note"];
                        break;
                    }
                case "app":
                    {
                        attachment.Type = typeof(ApplicationContent);
                        attachment.ApplicationContent = response["app"];
                        break;
                    }
                case "poll":
                    {
                        attachment.Type = typeof(Poll);
                        attachment.Poll = response["poll"];
                        break;
                    }
                case "page":
                    {
                        attachment.Type = typeof(Page);
                        attachment.Page = response["page"];
                        break;
                    }
                case "album":
                    {
                        attachment.Type = typeof(Album);
                        attachment.Album = response["album"];
                        break;
                    }
                case "photos_list":
                    {
                        attachment.Type = typeof(PhotosList);
                        attachment.PhotosList = response["photos_list"];
                        break;
                    }
                case "wall":
                    {
                        attachment.Type = typeof(Wall);
                        attachment.Wall = response["wall"];
                        break;
                    }
                case "sticker":
                    {
                        attachment.Type = typeof(Sticker);
                        attachment.Sticker = response["sticker"];
                        break;
                    }
                case "gift":
                    {
                        attachment.Type = typeof(Gift);
                        attachment.Gift = response["gift"];
                        break;
                    }
                case "wall_reply":
                    {
                        attachment.Type = typeof(WallReply);
                        attachment.WallReply = response["wall_reply"];
                        break;
                    }
                case "market_album":
                    {
                        attachment.Type = typeof(MarketAlbum);
                        attachment.MarketAlbum = response["market_album"];
                        break;
                    }
                default:
                    {
                        throw new InvalidParameterException(string.Format("The type '{0}' of attachment is not defined. {1}", type, response["date"]));
                    }
            }

            return attachment;
        }
Attachment