我有一个 JSON 编码的字符串。我也有 C# 类:
class Pupu{
public static List<Pupu> plist = new List<Pupu>();
public string user {get; set;}
public string number {get; set;}
}
[{"user":"27FFBADD7284E5CB98EAC45559589E28FDDDC3AD","number":"62827"},{"user":"27FFBADD7284E5CB98EAC45559589E28FDDDC3AD","number":"30460"}, {"user":"0D27D44D40C5185423078B3C93B3E6B596AD21A0","number":"25143"}, {"user":"0D27D44D40C5185423078B3C93B3E6B596AD21A0","number":"22776"}, {"user":"27FFBADD7284E5CB98EAC45559589E28FDDDC3AD","number":"19755"}]
我用以下方式对其进行反序列化:
plist = JsonConvert.DeserializeObject<List<Pupu>>(stringAbove);
我不断得到:
Attempt to access the method failed: System.Collections.Generic.List`1..ctor();
谢谢,我正在寻找这个几个小时。(我对 C# 很陌生)。