I'm wondering is this the best way to run two tasks in parallel but without using async/await.
public string Export()
{
var ifcFilePaths = ExportIfcFiles().ToList();
Task<List<IfcToCsvGraphExportResult>> graphConverterResults = ConvertIfcToGraphData(ifcFilePaths);
Task<List<IfcToGltfConversionResult>> gltfConverterResults = ConvertIfcToGltfData(ifcFilePaths);
List<string> folders = _outputFolderPacker.Pack(graphConverterResults.Result, gltfConverterResults.Result).ToList();
return _zipPacker.Pack(folders);
}
private Task<List<IfcToCsvGraphExportResult>> ConvertIfcToGraphData(List<string> ifcFilePaths)
=> Task.Run(() => _ifcToCsvGraphExporter.Export(ifcFilePaths).ToList());
private Task<List<IfcToGltfConversionResult>> ConvertIfcToGltfData(List<string> ifcFilePaths)
=> Task.Run(() => _ifcToGltfConverter.Convert(ifcFilePaths).ToList());
I want ConvertIfcToGraphData and ConvertIfcToGltfData methods to run in parallel, but on the other hand I want _outputFolderPacker.Pack() method to wait for both results before processing. My issue is I cannot make main Export() method async/await due to some API limitations.