Async and await in C# example

kudvenkat · 558K views · 2016 · 11:56

Open on YouTube

Software architecture & designWeb developmenttutorial

Why Stack Overflow recommends it

Stack Overflow users link it when askers need a quick, example-driven introduction to async/await in C#, such as keeping a UI responsive during a long-running task.

Recommended by 2 people across 2 different months, 2017 to 2018.

What it is

A short C# tutorial by kudvenkat (Venkat) that introduces the async and await keywords and walks through a worked example of using them. It is part of his beginner C# video series and has matching text and slide versions on his blog.

What people said

Recommends Khaled Gomaa · 2018-04 · Stack Overflow · on “Waitforexit interrupt my running application in unity”

Thanks guys but i found the final solution that works well here. it will save your time [this video] this my code after applying the solution :- And this my code after applying the solution in the video above public async void run_speechToText() { Task task = new Task(StartListening); task.Start(); Debug.Log("My exe file is running right now"); await task; get_answer(); } public void StartListening() { p.StartInfo = new System.Diagnostics.ProcessStartInfo("E:\\app\\dist\\app.exe"); p.StartInfo.WorkingDirectory = @"\Assets\\app\\dist\\app.exe"; p.StartInfo.CreateNoWindow = true; p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; p.Start(); p.WaitForExit(); }

Recommends Asela Liyanage · 2018-12 · Stack Overflow · on “WebApi .Net Core error as does not contain definition for GetAwaiter”

You should first understand what asynchronous programming is and the co-relation of await, async and Task. Asynchronous programming is used to improve the application performance and enhance the responsiveness. Refer the links at the bottom to get an understanding. First let's address your problem. Make your repo class return type as a Tak public async Task<IEnumerable<DashBoar>> GetPetsAsync() { var x = await (from n in _context.DashBoar select n).ToListAsync(); return x; } Then call the repo method from GetAllAsync() method as below public async Task<ActionResult<List<DashBoar>>> GetAllAsync() { var x = await _Repo.GetPetsAsync(); return x; } Please go through the below links To get a bett

Cites AlexS · 2017-11 · Stack Overflow · on “c# append text withou waiting for onclick event to finish”

Hi PeteGo, thanks for your answer. I found a video on youtube explaining what I was looking for ( [this video] ) but I will test your solution since I think will fit better to my needs.