I have a property:
public object Tag
but it can contain finite number of types, unfortunately without base type (except object type). But w
You can also use [XmlInclude(typeof(YourType))]
on the class that contains the object property. So in the case of the OP, it would look like this
[XmlInclude(typeof(PossibleClassOne))]
[XmlInclude(typeof(PossibleClassTwo))]
public class MyClass
{
public object Tag { get; set; }
}
This way, you can keep your element name
in all cases