I would like to be able to serialize a generic type against several different entities using the C# XmlSerializer. For example i want to serialize:
GenericThing<MyApp.A> and GenericThing<MyApp.B>
This all works well until i have something like the following:
GenericThing<MyApp.A.Entity> and GenericThing<MyApp.B.Entity>
Because these two classes have the same name the serializer cant differentiate between the two entities and attempts to serialize both to GenericThingOfEnitity.
Is there a way of decorating GenericThing so that it is more specific about its generic argument during serialization (ie serializes to GenericThingOfMyApp.B.Enitity or similar)? I unfortunately don’t have control over either MyApp.A or MyApp.B
You can specify different XML namespaces, e.g.: