i am trying to create a csv file from a string. I was able to create the csv file as string like so:
private void SaveToCsv<T>(List<T> reportData)
{
var lines = new List<string>();
IEnumerable<PropertyDescriptor> props = TypeDescriptor.GetProperties(typeof(T)).OfType<PropertyDescriptor>();
var header = string.Join(",", props.ToList().Select(x => x.Name));
lines.Add(header);
var valueLines = reportData.Select(row => string.Join(",", header.Split(',').Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
lines.AddRange(valueLines);
}
But I cannot seem to find out how to create an actual .csv file from the string in lines
, as the function app cannot follow a specific path (eg: D://drive/user/xya)
How do I create a file in code without a path in a function app?