我正在尝试使用reastharp连接到last.fm休闲服务。我可以将在示例中找到的简单数据进行反序列: http:// ws.audioscrobbler.com/2.0 /?method= artist.getInfo& artist=cher&api_key=xxxxxxxxxxxxxxxxxxxxxxxx

但是,当我到达艺术家的图像部分时:

<artist> 
  <name>Cher</name> 
  <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid> 
  <url>http://www.last.fm/music/Cher</url> 
  <image size="small">http://userserve-ak.last.fm/serve/34/48511693.png</image> 
  <image size="medium">http://userserve-ak.last.fm/serve/64/48511693.png</image> 
  <image size="large">http://userserve-ak.last.fm/serve/126/48511693.png</image> 
  <image size="extralarge">http://userserve-ak.last.fm/serve/252/48511693.png</image> 
  <image size="mega">http://userserve-ak.last.fm/serve/500/48511693/Cher+Tess.png</image> 
.

我正在努力让图书馆映射数据。这是我到目前为止的代码:

namespace *******.Core.LastFm
{
    using System.Xml.Serialization;
    using System.Collections.Generic;
    using System;

    public class image
    {
        [XmlAttribute]
        public string Size { get; set; }

        public string Value { get; set; }
    }

    public class ArtistImageCollection : List<image> { }

    public class Artist
    {
        public string Name { get; set; }
        public string Mbid { get; set; }
        public string Url { get; set; }
        [XmlArray]
        public ArtistImageCollection Image;
    }
}
.

这不起作用。有谁知道如何绑定这个?

[我更新了它以反映NIC建议 - 这仍然不起作用]

我得到了以下代码的基础: http://www.aaronstannard.com/post/2010/06/14/14/14/14/14/3/how-to-parse-a-users-delicious-feed-with-restsharp.aspx < / a>

w://

有帮助吗?

解决方案

在图像上没有得到/设置

doh

其他提示

你不需要用[xmarArray]和[xmarArray]的[属性]和图像注释尺寸吗?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top