Click here to Skip to main content
15,910,877 members
Home / Discussions / C#
   

C#

 
AnswerRe: Open Source PDF VIewer in Winform Pin
Gerry Schmitz30-Sep-15 9:52
mveGerry Schmitz30-Sep-15 9:52 
Questionasync and await concept Pin
Anil Sharma198328-Sep-15 20:29
professionalAnil Sharma198328-Sep-15 20:29 
AnswerRe: async and await concept Pin
Pete O'Hanlon28-Sep-15 21:05
mvePete O'Hanlon28-Sep-15 21:05 
GeneralRe: async and await concept Pin
Anil Sharma198328-Sep-15 21:13
professionalAnil Sharma198328-Sep-15 21:13 
GeneralRe: async and await concept Pin
Pete O'Hanlon28-Sep-15 21:16
mvePete O'Hanlon28-Sep-15 21:16 
GeneralRe: async and await concept Pin
Anil Sharma198328-Sep-15 21:26
professionalAnil Sharma198328-Sep-15 21:26 
AnswerRe: async and await concept Pin
Agent__00728-Sep-15 23:19
professionalAgent__00728-Sep-15 23:19 
AnswerRe: async and await concept Pin
F-ES Sitecore29-Sep-15 1:02
professionalF-ES Sitecore29-Sep-15 1:02 
Using await doesn't mean your code acts asynchronously. It still behaves as if the code is running synchronously (which is why it takes 8 seconds) but the difference is that when using await the underlying framework means the thread is available to use for other tasks if needed. If you didn't use await and instead just waited for the task to finish then your code would act no differently, but the thread that is waiting for the result can't be used for something else if needed. If you remove the "await" from the dowork then the method will take 3 seconds as dowork will be started on its own task and that will execute asynchronously and then DoAnotherWork will be called which will block for 3s synchronously.

C#
dowork(); // this will block execution for 5s as dowork is executed on the current thread
Task.Run(() => dowork());   // the dowork will happen on its own thread and that thread will run for 5 seconds
                            // but the code in this block will continue to run so dowork is an asynchronous call
await Task.Run(() => dowork()); // a mix of both the above.  The task will still run on its own thread for
                                // 5 seconds, but execution will wait until that new thread has finished

SuggestionRe: async and await concept Pin
Richard Deeming29-Sep-15 2:14
mveRichard Deeming29-Sep-15 2:14 
Questiongrid control, tile view Pin
Member 1201862628-Sep-15 20:00
Member 1201862628-Sep-15 20:00 
AnswerRe: grid control, tile view Pin
OriginalGriff28-Sep-15 20:11
mveOriginalGriff28-Sep-15 20:11 
QuestionWhy can I save the error information into the table of SQL server ? Pin
Member 245846728-Sep-15 17:40
Member 245846728-Sep-15 17:40 
AnswerRe: Why can I save the error information into the table of SQL server ? Pin
Wendelius28-Sep-15 17:57
mentorWendelius28-Sep-15 17:57 
GeneralRe: Why can I save the error information into the table of SQL server ? Pin
Member 245846729-Sep-15 17:36
Member 245846729-Sep-15 17:36 
GeneralRe: Why can I save the error information into the table of SQL server ? Pin
Wendelius29-Sep-15 18:15
mentorWendelius29-Sep-15 18:15 
GeneralRe: Why can I save the error information into the table of SQL server ? Pin
Member 24584672-Oct-15 2:56
Member 24584672-Oct-15 2:56 
QuestionSitemapnode(breadcrumb) value changes with multiple users Pin
nitin_ion28-Sep-15 4:09
nitin_ion28-Sep-15 4:09 
AnswerRe: Sitemapnode(breadcrumb) value changes with multiple users Pin
Pete O'Hanlon28-Sep-15 4:58
mvePete O'Hanlon28-Sep-15 4:58 
AnswerRe: Sitemapnode(breadcrumb) value changes with multiple users Pin
Richard Deeming28-Sep-15 6:30
mveRichard Deeming28-Sep-15 6:30 
QuestionPort some C++ code which contains WriteFile to C# Pin
Member 1206160028-Sep-15 1:48
Member 1206160028-Sep-15 1:48 
AnswerRe: WriteFile equivalent in C# Pin
Pete O'Hanlon28-Sep-15 3:00
mvePete O'Hanlon28-Sep-15 3:00 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 3:18
Member 1206160028-Sep-15 3:18 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 3:21
Member 1206160028-Sep-15 3:21 
GeneralRe: WriteFile equivalent in C# Pin
Dave Kreskowiak28-Sep-15 3:40
mveDave Kreskowiak28-Sep-15 3:40 
GeneralRe: WriteFile equivalent in C# Pin
Member 1206160028-Sep-15 3:55
Member 1206160028-Sep-15 3:55 

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.