Assume that i have these classes:
public class A
{
public int aField;
public C c;
}
public class B
{
public string bField;
public C c;
}
public class C
{
public string cField;
}
Now, i want to use JSON.Net JsonConverter annotation to serialize C as below when i want to load A or B objects. for example something like this:
[JsonConverter(typeof(JsonConverterCustomImpl))]
public class C
{
public string cField;
}
and the result of serialized A or B objects should be like this:
// A object
{
aField: 0,
cField: ''
}
// B object
{
bField: 0,
cField: ''
}
I dont know how shoud=ld i implement the JsonConverterCustomImpl class.
Aucun commentaire:
Enregistrer un commentaire