c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -
i developing app in xamarin android. have splash screen serialize class , pass mainactivity using intent. when try deserialize in mainactivity error message :
"serializationexception unable find constructor use types" serialization :
void loaddata() { currency currency = new currency(this); intent = new intent(this, typeof(mainactivity)); intent.putextra("currency", newtonsoft.json.jsonconvert.serializeobject(currency)); startactivity(intent); } deserialization :
cur = newtonsoft.json.jsonconvert.deserializeobject<currency> (intent.getstringextra("currency")); // error here class constructor :
public currency(context context) { thiscontext = context; } i began experiencing problem after added parameter context context constructor. has caused this? how can solve it? possible serialize/deserialize class has parameters?
you need have empty constructor in currency class in order deserialize it.
Comments
Post a Comment