私はこのようなものを持っています:
private void DoSomething()
{
System.Console.WriteLine("Creating Foo");
Foo result = new Foo();
DoSomethingAsync();
System.Console.WriteLine("Returning Foo");
return result;
}
private async void DoSomethingAsync()
{
// The following task takes a long time, but is not CPU intensive
await TaskEx.Run(() =>
{
// code lives here... removed for this example
});
}
CPUにあまり当たらないので、スレッドはいらないです。スレッドの作成を回避するには、Run の代わりに何を使用できますか?