What would be the cleanest way to await for a file to be created by an external application?
async Task doSomethingWithFile(string filepath)
This is how I'd do it:
await Task.Run(() => {while(!File.Exists(@"yourpath.extension")){} return;});
//do all the processing
You could also package it into a method:
public static Task WaitForFileAsync(string path)
{
if (File.Exists(path)) return Task.FromResult
and then just use it as this:
await WaitForFileAsync("yourpath.extension");
//do all the processing