Search for a design template to create

I am trying to find a design template that I can use to simplify the construction of some objects.

Based on an input parameter, a custom class, I am going to create various inheritors from the System.Windows.Forms.Control class.

For example, if the user class has one of its members set to "ChkBox", I want my class to return System.Windows.Forms.CheckBox, or if the element is "List", I want my class to return ComboBox.

public CustomClass()
{
    FieldType type;
}

and

GetControl(CustomClass type);

Usually all classes that I want to create have Control as the base class. With that in mind, I assume that there is a way to set elements in the base class in only one place.

Do you know which design template I can use to solve this problem?

+3
2

factory. factory - , , .

" " 4.

+3

Source: https://habr.com/ru/post/1704916/


All Articles