我无法通过名称“x640”获取缩略图.在当前上下文中不会退出
本文关键字:略图 上下文 退出 获取 x640 | 更新日期: 2023-09-27 18:12:36
public class Thumbnails
{
public string 640x640 { get; set; }
public string 50x50 { get; set; }
public string 320x320 { get; set; }
public string 200x200 { get; set; }
public string 120x120 { get; set; }
public string 100x100 { get; set; }
}
"thumbnails":
{
"640x640":"https://assets.mixrad.io/asset/artists/640x640/6500453.jpg",
"50x50":"https://assets.mixrad.io/asset/artists/50x50/6500453.jpg",
"320x320":"https://assets.mixrad.io/asset/artists/320x320/6500453.jpg",
"200x200":"https://assets.mixrad.io/asset/artists/200x200/6500453.jpg",
"120x120":"https://assets.mixrad.io/asset/artists/120x120/6500453.jpg",
"100x100":"https://assets.mixrad.io/asset/artists/100x100/6500453.jpg"
}
错误:名称"x640"在当前上下文中不存在。
我不能得到json缩略图。如何解决?
不能以数字开头声明任何属性、方法、变量、类等。您可以使用[JsonProperty("name")]
属性
public class Thumbnails
{
[JsonProperty("640x640")]
public string Image640 { get; set; }
[JsonProperty("50x50")]
public string Image50 { get; set; }
[JsonProperty("320x320")]
public string Image320 { get; set; }
[JsonProperty("200x200")]
public string Image200 { get; set; }
[JsonProperty("120x120")]
public string Image120 { get; set; }
[JsonProperty("100x100")]
public string Image100 { get; set; }
}
注意:如果你没有Json。