Динамическое добавление разных элементов в ToolStrip по строковому параметру

Есть код который формирует панель элементов, так, как мне необходимо, через строковые параметры. Как упростить код, чтобы вместо container.elem.Text, задавать свойство как container.Text

using System.Windows.Forms;
namespace TestApp {
    public partial class Form1 : Form {

        private ToolStrip toolStrip = new ToolStrip();

        public Form1() {
            InitializeComponent();

            string[] types = new string[] { "label", "button", "textbox", "combobox" };
            int i = 1;

            foreach (var sType in types) {
                ExToolStripItem container = null;
                if (sType == "textbox") {
                    ToolStripTextBox tb = new ToolStripTextBox();
                    container = tb;
                } else if (sType == "combobox") {
                    container = new ToolStripComboBox();
                } else if (sType == "button") {
                    container = new ToolStripButton();
                } else if (sType == "label") {
                    container = new ToolStripLabel();
                }

                container.elem.Text = "Element" + i;

                toolStrip.Items.Add(container.elem);

                i++;

            }

            this.Controls.Add(toolStrip);

        }

    }

    class ExToolStripItem {
        public ToolStripItem elem { get; set; }
        public static implicit operator ExToolStripItem(ToolStripButton el) {
            return new ExToolStripItem { elem = el };
        }
        public static implicit operator ExToolStripItem(ToolStripLabel el) {
            return new ExToolStripItem { elem = el };
        }
        public static implicit operator ExToolStripItem(ToolStripTextBox el) {
            return new ExToolStripItem { elem = el };
        }
        public static implicit operator ExToolStripItem(ToolStripComboBox el) {
            return new ExToolStripItem { elem = el };
        }
    }
}

Ответы (0 шт):