Cannot convert type child to type parent c#

50

Cannot convert type child to type parent c# -

//A simple way to downcast in C# is to json serialize the parent and then deserialize it into the child.

string serializedParent = JsonConvert.SerializeObject(parentInstance); 
 Child c  = JsonConvert.DeserializeObject<Child>(serializedParent);

Comments

Submit
0 Comments