I have a method like the following in a utility class. I would like to change the parameter dataSource to accept any type of data source, that is, DataSet, DataView, List<T>, DataTable, and ArrayList.
Is this possible? How would I change the method signature (and parameters and types) to allow me the flexibility of passing in any acceptable datasource for binding?
public void FillCombo(DropDownList ddl, DataTable dataSource, string textField, string valueField, bool addSelect) {
ddl.DataValueField = valueField;
ddl.DataTextField = textField;
ddl.DataSource = dataSource;
ddl.DataBind();
if (addSelect)
AddSelectCombo(ddl, "Select", -1);
}