public static IEnumerable <User> GetUsers(string file, string workSheet) { using (OleDbConnection connection = new ConnectionBuilder(new ConnectionString()).GetConnection(file)) { using (OleDbCommand command = connection.CreateCommand()) { command.CommandText = "SELECT * FROM [User$]"; using (OleDbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { User user = new User { Id = reader.GetValue <double>(0), LastName = reader.GetValue <string>(1), FirstName = reader.GetValue <string>(2), DateOfBirth = reader.GetValue <DateTime>(3) }; yield return(user); } } } } }