Prashant
Jun 3, 2022

--

Ok Michael, let me try to give it another shot:

1st:

"This has nothing to do with the discard operator, but is simply due to the fact that you don't do an "await LongRunning()". This statement self-contradictory. Discarding is all about NOT using await.

2nd:

Using Console.RealdLine() makes the Main function wait infinitely, which makes your LongRunning execute fully. However, this is not a real-life scenario. We don't know how long the Main function will take to finish after discarding an async function.

Thus, all I am trying to say is that if you are discarding an async function, you shouldn't use await inside that async function as it doesn't guarantee the execution of code after that. It may execute if the Main is still not finished - there you are right.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Prashant
Prashant

Written by Prashant

Finance guy who fell in love with technology and switched careers in early 30s. Follow me: https://twitter.com/prashantio Business URL: https://runtime.one

Responses (1)

Write a response