This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ExecutingOnANewThread() | |
{ | |
//both tasks defined bellow will be executed on a new background thread | |
var task = new Task(() => { }, TaskCreationOptions.LongRunning); | |
task.Start(TaskScheduler.Default); | |
//or | |
var task2 = Task.Factory.StartNew(() => { }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); | |
} |
NewerOlder