|
Listing 14-28 extracted from chapter Unsafe code, exceptions, anonymous methods, iterators
Listing 14-27< > Listing 14-29
This listing can be compiled with the command line: csc.exe /target:exe Example_14_28.cs Errors: 0 Warnings: 0
Example_14_28.cs
using System.Threading;
class Program {
static void Main() {
for (int i = 0; i < 5; i++){
int j = i;
ThreadPool.QueueUserWorkItem(delegate {
System.Console.WriteLine(j); }, null);
}
}
}
Copyright Patrick Smacchia 2006 2007
|