Answers for "Cannot convert type child to type parent c#"

C#
0

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);
Posted by: Guest on April-25-2022

C# Answers by Framework

Browse Popular Code Answers by Language