Skip to content

Instantly share code, notes, and snippets.

@renatoeufe
Created September 5, 2012 20:52
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 renatoeufe/3644557 to your computer and use it in GitHub Desktop.
Save renatoeufe/3644557 to your computer and use it in GitHub Desktop.
Exemplo de Async/Await C# 4.5
using System;
using System.Threading.Tasks;
namespace Exemplo.AsyncAwait
{
class Program
{
static void Main(string[] args)
{
Exec();
Console.ReadLine();
}
static async void Exec()
{
var task = Task.Run(() => SayHelloAsync());
Console.WriteLine(await task);
}
static async Task<string> SayHelloAsync()
{
return "Hello";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment