Example #1
0
        public DataTable CreateDataTableByEntryList <T>(List <T> list)
        {
            //Todo читать описание метода
            var dataTable = CreateDataTableColumnsByEntryWithType(list.First());
            var rowIndex  = 0;

            foreach (var entry in list)
            {
                var listProperties = _reflectionService.GetFieldValuesFromObjectThroughProperties(entry);
                dataTable.Rows.Add();
                for (int i = 0; i < listProperties.Count; i++)
                {
                    dataTable.Rows[rowIndex][listProperties[i].field] = listProperties[i].value;
                }
                rowIndex++;
            }
            return(dataTable);
        }