I'm currently working on a tool that should create some kind of custom .NET with some additional fields. I was wondering which approach is better to solve, and thought about the following options:
Option A:
- Create a derived class for each control (say, CLabel, CGroupBox ...), where I define new fields for each class. This will mean worse compatibility, but it will be easy to work with.
Example:
class CLabel: Label
{
public List<Control> RelatedControls {get; set;}
public String textHint;
public CLabel()
{}
}
Option B:
- This parameter does not mean creating a derived class from each control, but using the actual Label, GroupBox, etc. controls. And creating a class that encapsulates all the "extra" properties. This additional property object will be referenced in the property Control.Tag. I doubt it, because the reference to some complex object inside the property Tagseems a little crap to me, but it will mean better compatibility, and also, of course, there is no need for subclass elements.
Example:
Label lbl = new Label();
lbl.Tag = new ControlDescription();
C:
- - A B. Custom Control, CLabel, ControlDescription Label. , Tag.
, , , . , - , , - . , , ? , ?