I want to have a property in my class which can be of two types in .net6.
Class A {
public string Name {get;set;}
public int Age {get;set;}
}
Class B {
public string Name {get;set;}
}
//I want something like below:
Class MyClass{
public <A|B> myProperty {get;set;}
}
myProperty can be of any type A or B from the API response. How to deserialize this into A or B? Can anybody help how to achieve this?