Click here to Skip to main content
15,891,657 members
Home / Discussions / C#
   

C#

 
AnswerRe: Combobox and "autocompletion" Pin
TMattC26-Mar-15 0:23
TMattC26-Mar-15 0:23 
AnswerRe: Combobox and "autocompletion" Pin
Simon_Whale26-Mar-15 1:29
Simon_Whale26-Mar-15 1:29 
GeneralRe: Combobox and "autocompletion" Pin
TMattC26-Mar-15 4:38
TMattC26-Mar-15 4:38 
Questionadd PDF file to email body not an attachment Pin
sourabkhajuria25-Mar-15 23:49
sourabkhajuria25-Mar-15 23:49 
AnswerRe: add PDF file to email body not an attachment Pin
OriginalGriff25-Mar-15 23:53
mveOriginalGriff25-Mar-15 23:53 
AnswerRe: add PDF file to email body not an attachment Pin
Dave Kreskowiak26-Mar-15 1:27
mveDave Kreskowiak26-Mar-15 1:27 
QuestionUnderstanding Async / Await Pin
zephaneas25-Mar-15 10:07
zephaneas25-Mar-15 10:07 
AnswerRe: Understanding Async / Await Pin
F-ES Sitecore25-Mar-15 12:23
professionalF-ES Sitecore25-Mar-15 12:23 
Your main problem is in thinking that async is faster. The thing that takes the time is reading the file and both examples do that. The only difference is that in the second example the thread is freed up to other things while it waits for the task to complete. You're only going to see any benefit in doing this if your system is under a lot of load and doing a lot of heavy tasks. Further more, how much benefit you see with asynch processing depends on how many cores etc the machine has. While the asynch tasks may free up your threads, that comes at a cost too so it depends on if the benefit if the asynch code outweights the extra cost. So in your example running a single time you're getting no benefit from the asynch calls, but you're getting the overhead involved in the thread switching about.

If you want to time your code to see if there are any benefits to one thing over another then you can use the System.Diagnostics.Stopwatch class.
SuggestionRe: Understanding Async / Await Pin
Richard Deeming26-Mar-15 2:57
mveRichard Deeming26-Mar-15 2:57 
QuestionUse EPPlus to Read 1st Column Of Excel Workbook Into Array (.xlsx) Pin
Hellfire123125-Mar-15 4:42
Hellfire123125-Mar-15 4:42 
AnswerRe: Use EPPlus to Read 1st Column Of Excel Workbook Into Array (.xlsx) Pin
OriginalGriff25-Mar-15 5:25
mveOriginalGriff25-Mar-15 5:25 
QuestionEffective way of writing logs in web service in C#.net Pin
manishchourasia200025-Mar-15 0:19
professionalmanishchourasia200025-Mar-15 0:19 
AnswerRe: Effective way of writing logs in web service in C#.net Pin
Elegantly Wasted25-Mar-15 0:51
Elegantly Wasted25-Mar-15 0:51 
AnswerRe: Effective way of writing logs in web service in C#.net Pin
jschell25-Mar-15 11:28
jschell25-Mar-15 11:28 
QuestionCould not cal the repaint on invalidate Pin
Sarita S24-Mar-15 22:54
Sarita S24-Mar-15 22:54 
AnswerRe: Could not cal the repaint on invalidate Pin
OriginalGriff24-Mar-15 23:06
mveOriginalGriff24-Mar-15 23:06 
AnswerRe: Could not cal the repaint on invalidate Pin
OriginalGriff25-Mar-15 2:19
mveOriginalGriff25-Mar-15 2:19 
QuestionScheduler without using timer class in c# Pin
Member 1138787724-Mar-15 19:48
Member 1138787724-Mar-15 19:48 
AnswerRe: Scheduler without using timer class in c# Pin
Pete O'Hanlon24-Mar-15 20:13
mvePete O'Hanlon24-Mar-15 20:13 
QuestionSingleton vs Whatever Else Quandary Pin
Z.C.M.24-Mar-15 16:58
professionalZ.C.M.24-Mar-15 16:58 
AnswerRe: Singleton vs Whatever Else Quandary Pin
Mycroft Holmes24-Mar-15 17:09
professionalMycroft Holmes24-Mar-15 17:09 
AnswerRe: Singleton vs Whatever Else Quandary Pin
Pete O'Hanlon24-Mar-15 19:32
mvePete O'Hanlon24-Mar-15 19:32 
GeneralRe: Singleton vs Whatever Else Quandary Pin
Z.C.M.25-Mar-15 4:00
professionalZ.C.M.25-Mar-15 4:00 
AnswerRe: Singleton vs Whatever Else Quandary Pin
jschell25-Mar-15 11:34
jschell25-Mar-15 11:34 
QuestionWhat is wrong with the structure of this code? Pin
Member 1147801824-Mar-15 0:25
Member 1147801824-Mar-15 0:25 

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.