Determine type during json deserialize
问题 I'm working on a protocol in which the receiver will receive json messages of certain specified custom types (currently 5, but could be 10-20). I'm struggling to come up with an optimal/fast solution which will automatically deserialize the json and return the correct type of object. Example: public class MessageA { public string Message; } public class MessageB { public int value; } public class MessageC { public string ValueA; public string ValueB; } Ideally, the method should be like