Skip to content

Instantly share code, notes, and snippets.

@shiftkey
Created January 16, 2013 03:22
Show Gist options
  • Save shiftkey/4544405 to your computer and use it in GitHub Desktop.
Save shiftkey/4544405 to your computer and use it in GitHub Desktop.
Getting started with TPL
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace PortableClassLibrary1
{
public class Class1
{
public Class1()
{
Task.Factory.StartNew(DoSomething);
Task.Factory.StartNew(() => DoSomethingReturnTask())
.ContinueWith(t => Debug.WriteLine("This task finished"));
}
static void DoSomething()
{
// something long
}
static Task DoSomethingReturnTask()
{
return Task.Delay(TimeSpan.FromMinutes(1));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment