Click here to Skip to main content
15,505,828 members
Home / Discussions / C#
   

C#

 
AnswerRe: Skype Personal integration with C# Pin
Gerry Schmitz28-Sep-22 6:26
mveGerry Schmitz28-Sep-22 6:26 
GeneralRe: Skype Personal integration with C# Pin
Member 1462363928-Sep-22 7:10
Member 1462363928-Sep-22 7:10 
GeneralRe: Skype Personal integration with C# Pin
Victor Nijegorodov28-Sep-22 21:14
Victor Nijegorodov28-Sep-22 21:14 
GeneralRe: Skype Personal integration with C# Pin
Member 1462363928-Sep-22 21:22
Member 1462363928-Sep-22 21:22 
GeneralRe: Skype Personal integration with C# Pin
Mycroft Holmes29-Sep-22 14:18
professionalMycroft Holmes29-Sep-22 14:18 
GeneralRe: Skype Personal integration with C# Pin
Member 1462363929-Sep-22 20:48
Member 1462363929-Sep-22 20:48 
QuestionAsync - await Pin
dataminers20-Sep-22 5:22
dataminers20-Sep-22 5:22 
AnswerRe: Async - await Pin
OriginalGriff20-Sep-22 5:57
mveOriginalGriff20-Sep-22 5:57 
It gets a complicated, but basically the await call spins off a second thread to execute the long running task, and effectively suspends the method until it's complete. But ... the thread that executed await can continue as if the method had finished.

This is handy if you want to run a long task from the main (UI) thread while the UI remains responsive.
For example, if you run this code:
C#
private void MyOtherButton_Click(object sender, EventArgs e)
    {
    Debug.WriteLine("Before Sleep");
    Thread.Sleep(10000);
    Debug.WriteLine("After Sleep");
    }
Your console will print "Before Sleep", wait ten seconds and print "After Sleep" - but your user can't do anything else with your app in the mean time.
But this code:
C#
private async void MyOtherButton_Click(object sender, EventArgs e)
    {
    Debug.WriteLine("Before Sleep");
    await Task.Run(() => Thread.Sleep(10000));
    Debug.WriteLine("After Sleep");
    }
Prints the same things, but your user can carry on working - your UI remains working.

Have a look here: https://www.pluralsight.com/guides/understand-control-flow-async-await[^] - it explains it pretty well, and shows examples.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Async - await Pin
Richard Deeming20-Sep-22 6:01
mveRichard Deeming20-Sep-22 6:01 
AnswerRe: Async - await PinPopular
Richard Deeming20-Sep-22 6:06
mveRichard Deeming20-Sep-22 6:06 
GeneralRe: Async - await Pin
MarkTJohnson20-Sep-22 6:47
professionalMarkTJohnson20-Sep-22 6:47 
GeneralRe: Async - await Pin
dataminers21-Sep-22 1:04
dataminers21-Sep-22 1:04 
GeneralRe: Async - await Pin
Richard Deeming21-Sep-22 3:07
mveRichard Deeming21-Sep-22 3:07 
GeneralRe: Async - await Pin
dataminers21-Sep-22 6:33
dataminers21-Sep-22 6:33 
QuestionHow to make a license key system with Realtime DB? Pin
Moses Man19-Sep-22 1:11
Moses Man19-Sep-22 1:11 
AnswerRe: How to make a license key system with Realtime DB? Pin
OriginalGriff19-Sep-22 3:21
mveOriginalGriff19-Sep-22 3:21 
QuestionHow to create a many-to-many relationship between users in a table? Pin
Alex Wright 202216-Sep-22 7:16
Alex Wright 202216-Sep-22 7:16 
AnswerRe: How to create a many-to-many relationship between users in a table? Pin
Gerry Schmitz16-Sep-22 7:30
mveGerry Schmitz16-Sep-22 7:30 
GeneralRe: How to create a many-to-many relationship between users in a table? Pin
Alex Wright 202216-Sep-22 7:33
Alex Wright 202216-Sep-22 7:33 
GeneralRe: How to create a many-to-many relationship between users in a table? Pin
Gerry Schmitz16-Sep-22 7:42
mveGerry Schmitz16-Sep-22 7:42 
GeneralRe: How to create a many-to-many relationship between users in a table? Pin
Alex Wright 202216-Sep-22 7:55
Alex Wright 202216-Sep-22 7:55 
GeneralRe: How to create a many-to-many relationship between users in a table? Pin
Eddy Vluggen17-Sep-22 0:59
professionalEddy Vluggen17-Sep-22 0:59 
SuggestionRe: How to create a many-to-many relationship between users in a table? Pin
Richard Deeming19-Sep-22 22:16
mveRichard Deeming19-Sep-22 22:16 
QuestionProgram instalator in C#, Visual Studio Pin
Ismael_199912-Sep-22 6:36
Ismael_199912-Sep-22 6:36 
AnswerRe: Program instalator in C#, Visual Studio Pin
Gerry Schmitz12-Sep-22 7:21
mveGerry Schmitz12-Sep-22 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.