private List<T> ExecuteReader<T>(string commandText, AddToListDelegate<T> addToListMethod) { List<T> list = new List<T>(); using (var cmd = new SqlCommand(commandText, _cn)) { using (var dr = cmd.ExecuteReader()) { while (dr.Read()) addToListMethod(ref list, dr); } } return list; }
private List <T> ExecuteReader <T>(string commandText, AddToListDelegate <T> addToListMethod) { List <T> list = new List <T>(); using (var cmd = new SqlCeCommand(commandText, _cn)) { //SQL CE command time out can't be non-zero... Who knew? //cmd.CommandTimeout = _commandTimeOut; using (var dr = cmd.ExecuteReader()) { while (dr.Read()) { addToListMethod(ref list, dr); } } } return(list); }