Skip to content

Instantly share code, notes, and snippets.

@sandiks
Created December 27, 2019 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandiks/c9488d28d3590b638220e140ee84f109 to your computer and use it in GitHub Desktop.
Save sandiks/c9488d28d3590b638220e140ee84f109 to your computer and use it in GitHub Desktop.
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