C#.Rihter.Timer
simple example, task will be created periodically and will be handled in thread pool with Thread.QueueUserWorkItem
var timer = new Timer( (o) => {
simple example, task will be created periodically and will be handled in thread pool with Thread.QueueUserWorkItem
var timer = new Timer( (o) => {
simple example
int[] nums = Enumerable.Range(1, 10).ToArray(); var res = nums.AsParallel().Where(n => n < 5).ToArray(); Thread.Sleep(2000); Console.WriteLine(String.Join(» «, res));
output
1 2 3 4
tasks that can be done in parallel
static void Main(string[] args) { Parallel.For(1, 10, i => DoWork(i)); Thread.Sleep(12000); } static void DoWork(int i) {