Created
November 6, 2023 16:14
-
-
Save rahulsahay19/8378e773063e536187c658071582dbb9 to your computer and use it in GitHub Desktop.
ParallelForExample
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
using System; | |
using System.Threading.Tasks; | |
public class ParallelForExample | |
{ | |
public static void Main(string[] args) | |
{ | |
int sum = 0; | |
Parallel.For(1, 101, i => | |
{ | |
sum += i; | |
}); | |
Console.WriteLine("Sum of numbers from 1 to 100: " + sum); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment