Can any one help I have a method that will return a List to be bound as a datasource to a combobox see code for population below. I get the following error when i try to compile
'Error 29 Cannot implicitly convert type 'System.Collections.Generic.List<Prsym.ComboPopulation.ComboInfo>' to 'System.Collections.Generic.List<T>
Any help would be greatly receivedCode:/// <summary> /// Gets the data source to be bound to a ComboBox. /// </summary> /// <param name="storedProcedure">The Name of the Stored Procedure to be used.</param> /// <param name="scheme">The scheme.</param> /// <returns>A Generic List to be dound to a ComboBox</returns> private static List<T> GetDataSource<T>(string storedProcedure, PrsymScheme scheme) { Type dataSourceListType = typeof(T); if (dataSourceListType == typeof(ComboInfo)) { List<ComboInfo> dataSourceList = new List<ComboInfo>(); ComboInfo datSourceComboInfo = new ComboInfo(); DataBaseAccess DBA = new DataBaseAccess(scheme); SqlDataReader reader = null; DBA.LoadData(ref reader, storedProcedure); while (reader.Read()) { datSourceComboInfo.Display = reader["Display"].ToString(); datSourceComboInfo.Index = Convert.ToInt32(reader["Index"].ToString()); dataSourceList.Add(datSourceComboInfo); } //Clean up reader.Dispose(); System.Collections.ArrayList p = new System.Collections.ArrayList(); return dataSourceList; } else { return null; } }




Reply With Quote