I\'m trying to write generic method to cast types. I want write something like Cast.To
instead of (Type) variable
.
My wrong versi
You will never get this to work without a 'type converter'(a manual process of mapping across attributes for all known types which simply will not happen). You simply cannot just cast one non-related concrete class to another. It would break the single inheritance model (which is one of the defining principles of modern OOP - read up on 'the Diamond Problem')
It was also noted about interfaces (polymorphism) - both classes would have to derive from the same interface also (which is along the same lines)