Is there a way to make the method below generic?
CustomerData is a strongly-typed dataset. I would like to be able to somehow pass a generic strongly-typed dataset in as a parameter or however this can be done so that we only use one method for all instances. Otherwise we will need to duplicate this method about 10 times with different dataset types.
We would also pass in the table name as string for the dataset.
public string GetCustomerSuggestionList(string columnName, string prefix, int count)
CustomerData customerData = new CustomerData();
customerData = GetCustomersAll();
EnumerableRowCollection<DataRow> query = from customer in customerData.Tables["customer"].AsEnumerable()
where customer.Field<string>(columnName) != null && customer.Field<string>(columnName).ToLower().StartsWith(prefix.ToLower())
UtilityBF utilityBF = new UtilityBF();
return utilityBF.GetDistinctQueryItems(query, columnName, count);