public List <MailChimpUsers> GetUsersByDate() { List <MailChimpUsers> MyList = null; DateTime startDate = new DateTime(2017, 2, 27); DateTime currentDate = DateTime.Now; foreach (DateTime day in UtilityService.EachDay(startDate, currentDate)) { DataProvider.ExecuteCmd(GetConnection, "dbo.MailChimp_SelectUsers" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Date", day); } , map : delegate(IDataReader reader, short set) { MailChimpUsers Users = new MailChimpUsers(); int startingIndex = 0; //startingOrdinal Users.Email = reader.GetSafeString(startingIndex++); Users.ListId = reader.GetSafeString(startingIndex++); if (MyList == null) { MyList = new List <MailChimpUsers>(); } MyList.Add(Users); }); } return(MyList); }