我有一组以 CSV 格式存在于内存中的数据。我的控制器中有这个方法:
public FileContentResult ItemsAsExcelExport(){
var model = _itemService.GetExcelExportModel();
return new FileContentResult(model.CSVData, model.MimeType){FileDownloadName = model.FileName};
}
这里的问题是我的 model.CSVData 属性返回一组简单的逗号分隔值。我不确定如何满足 FileContentResult 构造函数的 fileContents 参数。它要求一个字节数组。
提前致谢。