Created
December 27, 2019 16:07
-
-
Save sandiks/c9488d28d3590b638220e140ee84f109 to your computer and use it in GitHub Desktop.
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; | |
class Program | |
{ | |
static void Main() | |
{ | |
while (true) | |
{ | |
// Start computation. | |
Example(); | |
// Handle user input. | |
string result = Console.ReadLine(); | |
Console.WriteLine("You typed: " + result); | |
} | |
} | |
static async void Example() | |
{ | |
int t = await Task.Run(() => Allocate()); | |
System.Console.WriteLine($"result {t}"); | |
} | |
static int Allocate() | |
{ | |
// Compute total count of digits in strings. | |
int size = 0; | |
for (int z = 0; z < 500; z++) | |
{ | |
for (int i = 0; i < 100_000; i++) | |
{ | |
string value = i.ToString(); | |
size += value.Length; | |
} | |
} | |
return size; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment