C#: Re-use code between objects with different base classes

Status
Not open for further replies.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
I've got two nearly identical controls similar to below:
Code:
namespace one
{
    public class SameNamedClass : System.Windows.Control
    {
        <Identical code>
    }
}
namespace two
{
    public class SameNamedClass : OurCustomControl //In-house descendant class of System.Windows.Control
    {
        <Identical code>
    }
}
Since my current bug I'm fixing is because a previous Dev made changes in one file, but not the other, I want to get all that identical code into a single source code file, but I can't figure out how I can do that cleanly.


(NOTE: The reason it is like this is because this control is reused between multiple apps, some of which use the extra functionality in OurCustomControl (color themes, etc.), but other, smaller apps do not support the extra functionality and need it to be derived directly from System.Windows.Control.)
 
Status
Not open for further replies.