Last active
November 9, 2018 10:13
-
-
Save yuessir/80b65518734eeb87f5e139f59a24e719 to your computer and use it in GitHub Desktop.
Using C# Thread.Sleep to Sort Array Ascending For FUN XDDDDDD
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
private static void Main(string[] args) | |
{ | |
int[] nums = new int[] { 13, 3, 889, 5455, 1, 152, 990 }; | |
ParameterizedThreadStart myPar = new ParameterizedThreadStart(SleepSort); | |
foreach (var num in nums) | |
{ | |
Thread myThread = new Thread(myPar); | |
myThread.IsBackground = true; | |
myThread.Start(num); | |
} | |
Console.ReadKey(); | |
} | |
public static void SleepSort(object i) | |
{ | |
Thread.Sleep(Convert.ToInt32(i)); | |
Console.WriteLine(Convert.ToInt32(i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment