Skip to content

Instantly share code, notes, and snippets.

@biac
Created December 9, 2011 13:11
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 biac/1451468 to your computer and use it in GitHub Desktop.
Save biac/1451468 to your computer and use it in GitHub Desktop.
LongTimeMethodAsync()
public static Task<int> LongTimeMethodAsync(int n)
{
return Task.Run<int>(() => LongTimeMethod(n));
//Run() は .NET Framework 4.5 から。 4.0 の StartNew() を使った以下のコードと同じ。
//return Task.Factory.StartNew<int>(
// () => LongTimeMethod(n),
// CancellationToken.None,
// TaskCreationOptions.DenyChildAttach,
// TaskScheduler.Default
// );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment