protected virtual void ExportTabItems() { string folder =SaveAs(); if (!string.IsNullOrEmpty(folder)) { var orderItems=new LinkedList<ExportorderItem>(); orderItems.AddFirst(GenerateHeader()); foreach (var exportorderItem in OrdersSummaryList.Select(MapExportItem).ToList()) { orderItems.AddLast(exportorderItem); } using (var sw = new StreamWriter(folder)) { sw.WriteAsync(orderItems.ToCsv()); sw.Close(); } MessageBox.Show("Done", "Distributr Info"); } }