Click here to Skip to main content
15,881,938 members
Home / Discussions / C#
   

C#

 
QuestionRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
Richard MacCutchan26-Aug-18 2:56
mveRichard MacCutchan26-Aug-18 2:56 
AnswerRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
OriginalGriff26-Aug-18 4:04
mveOriginalGriff26-Aug-18 4:04 
AnswerRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
Richard Andrew x6426-Aug-18 4:16
professionalRichard Andrew x6426-Aug-18 4:16 
AnswerRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
MadMyche27-Aug-18 9:38
professionalMadMyche27-Aug-18 9:38 
GeneralRe: C# float variable are losing their decimals after being inserted on MySQL database Pin
Richard Andrew x642-Sep-18 5:20
professionalRichard Andrew x642-Sep-18 5:20 
QuestionHow to get all excel cell data and update new data under specific cell using c# Pin
Sammed24-Aug-18 2:36
Sammed24-Aug-18 2:36 
QuestionC# List<Task> Execution Order Pin
Kevin Marois23-Aug-18 8:22
professionalKevin Marois23-Aug-18 8:22 
AnswerRe: C# List<Task> Execution Order Pin
Richard Deeming23-Aug-18 8:37
mveRichard Deeming23-Aug-18 8:37 
As always, the answer is "it depends". Smile | :)

It will depend on the current TaskScheduler[^], which is the class that actually schedules the work.

The default TaskScheduler uses the thread pool, so it will also depend on what other things are happening in your AppDomain at the time.

But in general, you can't depend on the tasks executing in a defined order. If your code requires a specific order, then that's a bug. You need to rewrite your code to explicitly execute the tasks in the required order, or to use synchronization primitives to prevent one task from executing before a task it depends on has finished.

One simple solution would be:
C#
// These tasks will execute in parallel, with no defined order:
await Task.WhenAll(
    FirstTask(),
    SecondTask(),
    ThirdTask(),
);

// This task won't execute until the first three have all finished:
await FourthTask();

// These tasks won't execute until the fourth task has finished.
// They will execute in parallel, with no defined order.
await Task.WhenAll(
    FifthTask(),
    SixthTask(),
);




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: C# List<Task> Execution Order Pin
Kevin Marois23-Aug-18 9:00
professionalKevin Marois23-Aug-18 9:00 
GeneralRe: C# List<Task> Execution Order Pin
Bernhard Hiller23-Aug-18 21:40
Bernhard Hiller23-Aug-18 21:40 
QuestionUnzip file from resources Pin
JCompier21-Aug-18 19:15
JCompier21-Aug-18 19:15 
AnswerRe: Unzip file from resources Pin
OriginalGriff21-Aug-18 19:34
mveOriginalGriff21-Aug-18 19:34 
AnswerRe: Unzip file from resources Pin
Daniel Pfeffer21-Aug-18 20:52
professionalDaniel Pfeffer21-Aug-18 20:52 
GeneralRe: Unzip file from resources Pin
JCompiler22-Aug-18 2:33
JCompiler22-Aug-18 2:33 
GeneralRe: Unzip file from resources Pin
Richard Deeming22-Aug-18 2:43
mveRichard Deeming22-Aug-18 2:43 
GeneralRe: Unzip file from resources Pin
JCompiler22-Aug-18 3:05
JCompiler22-Aug-18 3:05 
GeneralRe: Unzip file from resources Pin
JCompiler22-Aug-18 4:30
JCompiler22-Aug-18 4:30 
GeneralRe: Unzip file from resources Pin
Richard Deeming22-Aug-18 4:42
mveRichard Deeming22-Aug-18 4:42 
AnswerRe: Unzip file from resources Pin
jschell25-Aug-18 4:36
jschell25-Aug-18 4:36 
GeneralRe: Unzip file from resources Pin
Richard Deeming28-Aug-18 3:06
mveRichard Deeming28-Aug-18 3:06 
QuestionUse custom services inside OAuthorizationProviders Pin
Member 1204569221-Aug-18 3:39
Member 1204569221-Aug-18 3:39 
AnswerRe: Use custom services inside OAuthorizationProviders Pin
Pete O'Hanlon21-Aug-18 4:01
mvePete O'Hanlon21-Aug-18 4:01 
GeneralRe: Use custom services inside OAuthorizationProviders Pin
Member 1204569221-Aug-18 4:09
Member 1204569221-Aug-18 4:09 
GeneralRe: Use custom services inside OAuthorizationProviders Pin
dan!sh 21-Aug-18 4:41
professional dan!sh 21-Aug-18 4:41 
GeneralRe: Use custom services inside OAuthorizationProviders Pin
Member 1204569221-Aug-18 8:34
Member 1204569221-Aug-18 8:34 

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.