c# - Is it okay to not await async method call? -
i have application upload files. don't want application halt during file upload, want task asynchronously. have this:
class program { static void main(string[] args) { //less 5 seconds prepareupload(); } private static async task prepareupload() { //processing await upload(); //processing } private static task upload() { var task = task.factory.startnew(() => system.threading.thread.sleep(5000)); return task; } }
the exceptions being treated internally, not problem.
is okay use async/away shoot , forget this?
in console app, need wait. otherwise, application exit, terminating background threads , asynchronous operations in progress.
Comments
Post a Comment