这是一个例子:
public class FotoLiveLove
{
public string Tipologia { get; set; }
public string URL { get; set; }
}
IList<FotoLiveLove> fotoLiveLove = xDoc["statuses"].Select(x => new
{
Tipologia = "twitter",
URL = (string)x["URLJSON"]
}).ToList();
Run Code Online (Sandbox Code Playgroud)
但它表示无法将匿名类型#1转换为FotoLiveLove.
Cod*_*gue 15
您需要在new关键字后面添加您的类名:
IList<FotoLiveLove> fotoLiveLove = xDoc["statuses"].Select(x => new FotoLiveLove()
{
Tipologia = "twitter",
URL = (string)x["URLJSON"]
}).ToList();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
190 次 |
| 最近记录: |