I need to create a class which is building up an XML config file based on another objects.
There are 3 various objects. The building algorithm is very similar for all objects,but not same.
I was thinking of using a base class with an abstract method and then just create a derived classes with where I'd override the abstract method.
But the problem is those 3 object doesn't have a common interface or base class. Those objects are third party components. I can't refactor them. So there isn't any common contract for all objects.
Is there any convenient solution for this situation ? Maybe some design pattern I don't know about ?
You could define a XMLSerializable
abstract class and then use the Adapter pattern to adapt these third party components into XMLSerializable
objects
you can create your 3 custom class extending them respectively [I am not sure about C#], and implement a common contract.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With