Let's discuss how to export data or lists in CSV format. For this purpose, we will implement Custom Response Formatter CsvOutputFormatter and a generic helper CsvWriter to convert any List of objects to CSV format. We are going to extend our application from our last discussion CRUD Operations In ASP.NET Core 1.0 MVC Application - Part Seven.

Add CsvWriter in WebApplicationCore.NetCore

Add CsvOutputFormatter in WebApplicationCore.NetCore

GetCsv Action Method and Get CSV Link

Run Application in Debug Mode

Sample Source Code

I have placed sample code for this session in "CRUD operations in ASP.NET Core 1.0 MVC Application Part 8_Code.zip" in CodePlex repository.