Configure.Await(false) with fire and forget async calls

  • A+
Category:Languages

Currently in my console application, I do the following to delete files in fire and forget style.

I was wondering if there is any performance gain in setting ConfigureAwait(false) for each of these Task.Run calls?

(My assumption is no, since I am not awaiting the call but I am not sure)

 for(var file in files)   '   '   // Check for certain file condition and decide to delete it.    '   '   if(shouldDeleteFile)   {     Task.Run(() => File.Delete(file));   } 

 


ConfigureAwait(false) would not do anything here, because there is no await to configure.

It's "configure await", not "configure task".

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: