Hi
I have a BaseClass
Then I have multiple classes that I want to derive from controls and inherit / implement the BaseClass.
There is no multiple inheritance in c#, so I have to derive form the control itself, but how do I then extend my class to implement the BaseClass.
I need to be able to manage common properties of different controls for xml serialization purposes.
What would be the best way to do this?
I have thought of creating a BaseClass like
and then inherit from that and create a new control like
But this way is creating lots of work downstream.
Is there a better way to implement this scenario?
Thanks
Franna
I have a BaseClass
Code:
public class BaseClass
{
[XmlIgnore]
public PropertyGrid PropertyGridControl
[XmlAttribute("Name")]
public string Name
{ get; set; }
}
Code:
public class MyLabel : Label
{
}
public class MyPanel : Panel
{
}
I need to be able to manage common properties of different controls for xml serialization purposes.
What would be the best way to do this?
I have thought of creating a BaseClass like
Code:
public class BaseClass
{
[XmlIgnore]
public PropertyGrid PropertyGridControl
[XmlAttribute("Name")]
public string Name
{ get; set; }
[XmlIgnore]
protected Control ControlObj;
}
Code:
public class MyLabel : BaseClass
{
public MyLabel() : base()
{
ControlObj = new Label();
}
}
public class MyPanel : BaseClass
{
public MyPanel() : base()
{
ControlObj = new Panel();
}
}
Is there a better way to implement this scenario?
Thanks
Franna
Comment