[英]I can't get a thumbnails by the name “x640” doesnt exit in the current context
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"
}
Error: The name "x640" doesnt exit in the current context.
错误:名称“ x640”在当前上下文中不存在。
I can't get thumbnail by json. 我无法通过json获取缩略图。 How to solve it?
怎么解决呢?
You cannot declare, any property, method, variable, class etc. starting from digits. 您不能以数字开头声明任何属性,方法,变量,类等。 You can use
[JsonProperty("name")]
attribute 您可以使用
[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; }
}
Note: If you have not Json.Net package, then install it from here . 注意:如果您没有Json.Net软件包,请从此处安装它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.