If I call an async
function on a nameless instance, will the instance stay alive until the function finishes? For example, if I have a server that I need to run in the background for some time. I am not interested in the state of this server or in tracking it in any way. I may do something like this:
...
new MyServer().Start();
...
class MyServer {
...
async Task Start() { ... }
...
}
will the Start
method run till completion, or will the nameless referenceless instance be GC before it is finished running?