Created
June 16, 2011 21:59
-
-
Save analogrelay/1030397 to your computer and use it in GitHub Desktop.
Sleepsort for C#!
This file contains hidden or 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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Threading; | |
namespace ConsoleApplication2 { | |
class Program { | |
static void Main(string[] args) { | |
var tasks = from arg in args | |
select new Thread(() => { | |
int val = -1; | |
if (Int32.TryParse(arg, out val)) { | |
Thread.Sleep(val * 1000); | |
Console.WriteLine(val); | |
} | |
}); | |
foreach (var task in tasks) { | |
task.Start(); | |
} | |
Console.ReadLine(); | |
} | |
} | |
} |
No. :P
…-----Original Message-----
From: pranavkm [mailto:[email protected]]
Sent: Thursday, June 16, 2011 3:21 PM
To: Andrew Nurse
Subject: Re: gist gist: 1030397
Remove and sort usings
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1030397
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remove and sort usings