Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ExcelExportFileService  excelExportFileService = new ExcelExportFileService();
            IList <PerformanceInfo> performanceInfos       = new List <PerformanceInfo>();
            HashSet1 hashSet1 = new HashSet1();
            HashSet2 hashSet2 = new HashSet2();
            Task     task1    = new Task(() => hashSet1.Method());
            Task     task2    = new Task(() => hashSet2.Method());

            performanceInfos.Add(PerformanceService.MeasurePerformance(task1));
            performanceInfos.Add(PerformanceService.MeasurePerformance(task2));
            if (File.Exists(excelExportFileService.ExcelFilePath))
            {
                File.Delete(excelExportFileService.ExcelFilePath);
            }
            using (var excelPackage = new ExcelPackage(new System.IO.FileInfo(excelExportFileService.ExcelFilePath)))
            {
                ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add(excelExportFileService.PopulateWorkSheetName(null));
                excelExportFileService.ExportPerformanceInfoToExcel(performanceInfos, worksheet);
                excelPackage.Save();
            }
        }