How to combine two classes in one block?

List<ReportDataInfo> Lrdi = new List<ReportDataInfo>();
ReportDataInfo rdi = new ReportDataInfo();
ReportDataInfo RdiMerge=new ReportDataInfo();
string[] AccountTypeCodeCustomArray = 
AccountCodeTypeCustom.Split(",".ToCharArray());
string[] SubTypeCodeCustomArray = 
SubAccountTypeCodeCustom.Split(",".ToCharArray());
string[] AccountCodeCustomArray = AccountCodeCustom.Split(",".ToCharArray());
for (int i = 0; i < AccountCodeTypeCustom.Length; i++)
{
    rdi = ExportDataToCSV.GetLedgerReportData(Globals.GetInt( 
     AccountTypeCodeCustomArray[i],0),Globals.GetInt( 
     SubTypeCodeCustomArray[i],0),Globals.GetInt( AccountCodeCustomArray[i],0), 
     this.CurrentSessionInfo.Company.CompanyCode, 
     this.CurrentSessionInfo.FinancialYear.StartDate, 
      this.CurrentSessionInfo.FinancialYear.EndDate);
   // Lrdi.Add(rdi);
    RdiMerge.Rows.Concat(rdi.Rows);                        
    //RdiMerge.ReportHeading = rdi.ReportHeading;
    //RdiMerge.Rows = rdi.Rows;
}

CurrentSessionInfo.ReportData = RdiMerge;

This is what I tried before

Now my question is: I want the merge to be returned ReportDataInfo from ExportDataToCSV.GetLedgerReportData ();

I am stuck here with any values ​​returned from ExportDataToCSV.GetLedgerReportData (); I want to merge into one ReportDataInfo , and then go to CurrentSessionInfo.ReportData = RdiMerge;

ReportDataInfolooks like

[Serializable]
public class ReportDataInfo
{
    public string ReportHeading { get; set; }
    public List<ReportColumnInfo> Rows { get; set; }
}
+4
source share
1 answer

he just uses automapper

AutoMapper - - mapper, . , CustomerDTO AutoMapper.

+1

Source: https://habr.com/ru/post/1538347/


All Articles