I have a bunch of different DTO classes. They are being serialized into an XML string at one point and shot over to client-side of the web app. Now when the client shoots
if you have custom serialization/deserialization routine for each type, you could use something like this
public T Deserialize (string xml)
{
if(typeof(T) == typeof(Person))
{
// deserialize and return Person instance
}
else if(typeof(T) == typeof(Address)
{
// deserialize and return Address instance
}
...
...
...
}
And you can call
Person p = Deserialize(personXmlStringFromClient);