public static void CreateAdapterAsDataSource <T>(this ComboBox comboBox, IEnumerable <T> elements, ComboBoxAdapter <T> .ToStringFunctionDelegate toStringFunction, bool containsNull = false, string nullLabel = "") where T : class { ComboBoxAdapter <T> adapter = new ComboBoxAdapter <T>(elements, toStringFunction, containsNull, nullLabel); comboBox.SetAdapterAsDataSource(adapter); }
public ComboBoxAdapterFactory(IEnumerable <T> elements, ComboBoxAdapter <T> .ToStringFunctionDelegate toStringFunction, bool containsNull = false, string nullLabel = "") { this.elements = elements; this.toStringFunction = toStringFunction; this.containsNull = containsNull; this.nullLabel = nullLabel; }