Async/Await in C# - How it works and how to use it

Async/Await in C# - How it works and how to use it

Code Insights

11 лет назад

178,811 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Kent Hervey
Kent Hervey - 06.08.2023 03:57

thanks

Ответить
Grant Tapp
Grant Tapp - 29.05.2023 23:56

Went through 3 pages to find something like this! Great video!

Ответить
Danny
Danny - 24.05.2023 01:21

Thank you. Very good explanation.

Ответить
Rizki AQA
Rizki AQA - 24.03.2023 20:49

Thanks

Ответить
Wahid Uddin
Wahid Uddin - 17.03.2023 04:45

You’ve made it so clear! Took me so long to find a clear and concise video. Thanks!

Ответить
Nick Kat
Nick Kat - 16.07.2022 22:35

this vid deserves more likes

Ответить
Hoot look
Hoot look - 07.06.2022 10:33

Straight to the point thank you

Ответить
Rares Petru Samartean
Rares Petru Samartean - 12.12.2021 23:45

await was so confusing because to me at least, it does exactly the OPPOSITE of what I would expect it to...it makes the program NOT wait for the function to finish...you'd think "await" would "await" a result (which happens by default I know) but it does the opposite? wtf

Ответить
Laurence
Laurence - 10.12.2021 06:29

does await block the next line of code? or does it run together with other tasks?

lets say I have a code to write two files

var task1 = Task.Run(async () => await streamWriter1.WriteLine(...........;
var task1Res = task1.GetAwaiter().GetResult();

var task2 = Task.Run(async () => await streamWriter2.WriteLine(...........;
var task2Res = task2.GetAwaiter().GetResult();

will task2 execute while task1 is running? or will it wait for task1 to complete before it executes?

Ответить
Angelo Solazzo
Angelo Solazzo - 29.10.2021 11:17

It’s not best practice use async void method , Rather you should use async Task if you want return void

Ответить
Niels Gregersen
Niels Gregersen - 17.04.2021 02:19

No there is no cost, only benefit. You should focus on writing good code instead of worrying about unimportant micro optimizations

Ответить
Channel
Channel - 12.03.2021 06:43

so the cost of async/await is the additional memory required for the state machine, i guess? Is that even worth considering?

Ответить
cepi24
cepi24 - 10.09.2020 23:57

Please explain async awaot in js

Ответить
Siddharth Shinde
Siddharth Shinde - 28.03.2020 20:31

I got orgasm watching this 😁

Ответить
Frank Thomas
Frank Thomas - 19.02.2020 22:45

Agreed, good explanation. Does shed light on the inner workings.

Ответить
Mukul Pandya
Mukul Pandya - 28.11.2019 18:11

One of the best explanations for async/await!! Great job!

Ответить
Hindo
Hindo - 24.11.2019 22:09

yo, huge opening with electric6, insta subscribed

Ответить
Mindaugas M
Mindaugas M - 24.10.2019 15:00

Basically the second thread comes into play from the point/line "await" is added. "async" does not do anything?!..

Ответить
His-Word Devotionals
His-Word Devotionals - 22.10.2019 12:28

Awesome man thank you!

Ответить
spiralni
spiralni - 16.10.2019 23:00

After a thousand years, I've finally got it!! the best explanation ever.

Ответить
Moissane Hernandez
Moissane Hernandez - 28.09.2019 16:46

What a great explanation in record time, very straight and precise is what makes this video great!

Ответить
vinod kc
vinod kc - 10.07.2019 19:23

Hi, from where i can get the complete code of this tutorial ?

Ответить
En Acorn
En Acorn - 10.07.2019 05:02

Well done! better than porn

Ответить
Raw Coding
Raw Coding - 05.07.2019 10:47

Well done! really good explanation, much prefer the bare bones, to a WPF button example. Special points for the generated code dive <3

Ответить
xk y
xk y - 05.06.2019 18:33

Cool, but where is the porn?

Ответить
Calmshot
Calmshot - 27.05.2019 13:59

So, that means that under the hood async is using an automated multithreading aproach?

Ответить
barbelljoe
barbelljoe - 15.04.2019 13:06

This is strange porn. My brain hurts and my forearm is not getting any exercise whatsoever.

Ответить
Brady Christen
Brady Christen - 14.04.2019 21:04

Thank you for your great explaination!! helped me a ton with my current homework!!

Ответить
Dieter Haug
Dieter Haug - 18.03.2019 19:45

is this SFW? o.O

Ответить
Sai Kiran
Sai Kiran - 17.02.2019 16:17

does aync create a new thread or it uses same thread?

Ответить
jwgmail
jwgmail - 24.01.2019 21:45

Dear God, thank you. I watched 2 other 45-60min videos that completely sucked. The only thing I still have a little confusion on is .Result() but I'll figure it out

Ответить
Kavarod
Kavarod - 07.12.2018 22:45

nice

Ответить
lapincheriatota
lapincheriatota - 15.11.2018 09:15

Will the async code span a new thread while the rest of your code executes?

Ответить
mrlildylchillin
mrlildylchillin - 10.11.2018 23:41

This video is brilliant! I really appreciate the depth and clarity you have managed to go into in only 6 minutes. Well done!

Ответить
collin visser
collin visser - 10.11.2018 20:55

Thanks for the simple video. Helped me a lot

Ответить
Lincoln White
Lincoln White - 10.09.2018 22:24

I've looking for about 8 hours trying to understand Async/Await on non async methods. Thanks very much for explaining it all and in under 7 minutes! I nearly gave up but luckily found this video

Ответить
Debashish Sarkar
Debashish Sarkar - 05.07.2018 02:56

Async/Await demystified. Presentation is crisp and precise. Subscribed 👍

Ответить
Erez Levi
Erez Levi - 20.06.2018 22:30

Awesome video, very clear.
Thanks!

Ответить
Florian Rager
Florian Rager - 29.05.2018 19:04

Very nice and quick video. It helped a lot in geting started with async and await.
Keep up the good work!!

Ответить
creative chimera's studio
creative chimera's studio - 15.02.2018 23:43

Thanks for thie concise and clear explanation! I found the line-by-line break down very helpful!

Ответить
V N
V N - 14.11.2017 00:49

I was always so confused by Async and await and was always very insecure on how to use it. The decompiling was the best explanation I ever saw! Thanks a lot!

Ответить
Anil Jain
Anil Jain - 14.09.2017 13:05

The presentation is simply superb and really professional!! Great job!!

Ответить
Callmephil
Callmephil - 04.02.2017 10:05

Hello ! thanks for the explanation about async methods, i have a little question, i'm coding a kind of puzzle assembler in witch each piece are composed of small other puzzles. i have around 10 algorithm per piece and the main puzzle is around 1.5M piece X24(for sub pieces) i currently got my puzzle solved for 150K pieces per 10 minutes. however i still use sync method. i would like to improve performance and stability by using Async however i couldn't figure out how to implement it with ThreadPool and Task Factory. any tips to do that ?

Ответить
deedd micic
deedd micic - 26.10.2016 03:14

Like and sub for grat expl. THANKS

Ответить
Basheer AL-MOMANI
Basheer AL-MOMANI - 29.09.2016 16:31

nice channel name

Ответить