How to fill a datagridview with a combination of two anonymouses list?

Viewed 8

I am working on a transaction system in c#. Now I want to have a report from two tables in one datagridview. I have created two methods that return anonymous types, then I combined thier result as a list. When I want to fill the datagridview by this combined list, there are some error.this is the error

 using (UnitOfWork db = new UnitOfWork())
        {
           List<object> result = new List<object>();
            List<CustomerAccountReportView> accounts = new List<CustomerAccountReportView>();             
            accounts.AddRange(db.CustomerAccountReportViewGenericRepository.Get());
            result.AddRange(db.ITransactionRepository.GetSumOfAmountAccordingToCurrencyType(0));
            result.AddRange(db.ICustomerAccountViewRepository.GetDistinctAccounts(accounts));

            dvgAccountsList.AutoGenerateColumns = false;
            dvgAccountsList.DataSource = result;
         

        }
0 Answers
Related