假设我有以下JSON
{
id: 5,
sub: {
id: 7
}
}
我的c#定义为
public class outer {
public int id;
public inner sub;
public class inner {
private _outerRef;
public inner(outer outerRef) {
_outerRef = outerRef;
}
public int id;
public string name {
get {
return id + "." + _outerRef.id;
}
}
}
}
如何对JSON进行反序列化,以便传递对外部类的引用?
编辑:
从技术上讲,我的c#类将是
public class outer {
public int id;
public List<inner> subs;
public class inner {
private _outerRef;
public inner(outer outerRef) {
_outerRef = outerRef;
}
public int id;
public string name {
get {
return id + "." + _outerRef.id;
}
}
}
}