countdownevent
C#
class Program
{
static void Main(string[] args)
{
CountdownEvent countObject = new CountdownEvent(10);
int[] result = new int[10];
for (int i = 0; i < 10; ++i)
{
int j = i;
Task.Factory.StartNew(() =>
{
Thread.Sleep(TimeSpan.FromSeconds(3));
result[j] = j * 10;
countObject.Signal();
});
}
countObject.Wait();
foreach (var r in result)
{
Console.WriteLine(r);
}
Console.ReadLine();
/* Result
* 0
* 10
* 20
* 30
* 40
* 50
* 60
* 70
* 80
* 90 */
}
}
Also in C#:
- Title
- leantween id
- Category
- C#
- Title
- c# switch case with or condition
- Category
- C#
- Title
- how to access the dictionary from another script in unity
- Category
- C#
- Title
- c# list to string
- Category
- C#
- Title
- copy to clipboard unbity
- Category
- C#
- Title
- use newtonsoft json to clone object
- Category
- C#
- Title
- how to switch scenes unity
- Category
- C#
- Title
- unity if gameobject exists
- Category
- C#
- Title
- wpf datatrigger enum binding
- Category
- C#
- Title
- create asp.net which send email and sms using own api
- Category
- C#
- Title
- iformfile blobclient
- Category
- C#
- Title
- c# read char
- Category
- C#
- Title
- uinput dialog uwp c#
- Category
- C#
- Title
- c# change label forecolor code
- Category
- C#
- Title
- c# one line set
- Category
- C#
- Title
- unity get all by tag
- Category
- C#
- Title
- c# foreach arra
- Category
- C#
- Title
- eventos c#
- Category
- C#
- Title
- asp net mvc 5 return view from another controller
- Category
- C#
- Title
- datatable return column names
- Category
- C#
- Title
- set object to random color unity
- Category
- C#
- Title
- unity transformer double en float
- Category
- C#
- Title
- c# escape characters
- Category
- C#
- Title
- condition when a animation finishes in unity
- Category
- C#
- Title
- unity create a child object
- Category
- C#
- Title
- unity get child
- Category
- C#
- Title
- c# how to run external program with args
- Category
- C#
- Title
- ping with c#
- Category
- C#
- Title
- c# make http request
- Category
- C#
- Title
- razor preview
- Category
- C#
- Title
- how do i limit the amount of prefabs in unity using c# script
- Category
- C#
- Title
- convert number of days into months c#
- Category
- C#
- Title
- how to add a list to observablecollection in c#
- Category
- C#
- Title
- winforms timer c#
- Category
- C#
- Title
- debug.log
- Category
- C#
- Title
- why is c# say ; expected
- Category
- C#
- Title
- c# zip a file
- Category
- C#
- Title
- unity object array
- Category
- C#
- Title
- office open xml check if row is empty
- Category
- C#
- Title
- how to set progress openedge driver name for odbc connection c#
- Category
- C#
- Title
- how to say or in c#
- Category
- C#
- Title
- get waht is differnt between two arrays c#
- Category
- C#
- Title
- c# resize image keep aspect ratio
- Category
- C#
- Title
- c# string to float
- Category
- C#
- Title
- how to store some variables on the device in unity
- Category
- C#
- Title
- c sharp exit while loop
- Category
- C#
- Title
- unity list
- Category
- C#
- Title
- c# image to byte array
- Category
- C#
- Title
- list with two values c#
- Category
- C#
- Title
- winforms messagebox with button
- Category
- C#
- Title
- same click event diffrenet buttonms c#
- Category
- C#
- Title
- c# change colour of console
- Category
- C#
- Title
- mysql executeScalar only if successful
- Category
- C#
- Title
- how to add array to list in c#
- Category
- C#
- Title
- out parameters c#
- Category
- C#
- Title
- unity fps counter
- Category
- C#
- Title
- No context type was found in the assembly
- Category
- C#
- Title
- c# read file stream
- Category
- C#
- Title
- unity get component
- Category
- C#
- Title
- using in c#
- Category
- C#
- Title
- c# quaternion eular calculator
- Category
- C#
- Title
- downlaod file and use C#
- Category
- C#
- Title
- unity rotate around axis
- Category
- C#
- Title
- c# mongodb update multiple fields
- Category
- C#
- Title
- c# window instantly close
- Category
- C#
- Title
- c# catch two exceptions in one block
- Category
- C#
- Title
- get web config key value in c# razor view
- Category
- C#
- Title
- unity array of child objects
- Category
- C#
- Title
- when do i need to end a sentence with ; in c#
- Category
- C#
- Title
- c# get time
- Category
- C#
- Title
- unity how to get transform scale
- Category
- C#
- Title
- unity fall damage c#
- Category
- C#
- Title
- countdown script unity
- Category
- C#
- Title
- c# arraylist contains
- Category
- C#
- Title
- c# length of array
- Category
- C#
- Title
- unity rigidbody constraints
- Category
- C#
- Title
- c# string contains space
- Category
- C#
- Title
- devexpress objectspace to session
- Category
- C#
- Title
- c# resize bitmap
- Category
- C#
- Title
- c sharp create dictionary
- Category
- C#
- Title
- unity how to change text in script
- Category
- C#
- Title
- c# windows forms draw pixel
- Category
- C#
- Title
- unity detect any key
- Category
- C#
- Title
- multidimensional meaning
- Category
- C#
- Title
- c# split a string and return list
- Category
- C#
- Title
- unity 2d top down movement
- Category
- C#
- Title
- c# if statement
- Category
- C#
- Title
- uncaught syntaxerror invalid or unexpected token unity webgl
- Category
- C#
- Title
- add row and columns to grid wpf in code
- Category
- C#
- Title
- asp.net core task iactionresult
- Category
- C#
- Title
- c# webcam
- Category
- C#
- Title
- c# string to lowercase
- Category
- C#
- Title
- check which activity in focus in android
- Category
- C#
- Title
- find gameobject with tag
- Category
- C#
- Title
- c# input integer
- Category
- C#
- Title
- ecs get specific entities with component
- Category
- C#
- Title
- dynamically add rows to datagridview c#
- Category
- C#
- Title
- unity vector3 smoothdamp not reaching target
- Category
- C#
- Title
- navigate to another page with an object uwp c#
- Category
- C#
- Title
- unity get max occurrence in list
- Category
- C#