This is an example of how to convert a generic list to a dynamic downloadable .csv file using C#, the CsvHelper library and the FileStreamResult.
Download the repo and run the full project solution from Github
In this example a request comes into the controller, we create a generic list