Console.WriteLine(" .");
}
}
.
.
MyTas ()
MyTaskO 0
MyTask() 1 2 3 4 .
, , . , Main () . , MyTask () ContTask . , MyTask () , , .
, -. .
// -. Task taskCont = tsk.ContinueWith((first) =>
{
Console.WriteLine(" "); for(int count = 0; count < 5; count++) {
Thread.Sleep (500);
Console.WriteLine(" " + count);
}
Console.WriteLine(" ");
}
);
first ( tsk).
ContinueWith (), Task , , TaskFactory. ContinueWhenAny () ContinueWhenAll (), , .
. . -, , . . -, , . , .
, , Task<TResult> Task. Task:
public Task(Func<TResult> )
public Task(FuncCObject, TResult> , Object )
. , Func, Action. Func , . , , Object, . .
|
|
, StartNew (), TaskFactory<TResult> . , Task.
public Task<TResult> StartNew(Func<TResult> )
public Task<TResult> StartNew(Func<Object,TResult> , Object )
, , Result Task, .
public TResult Result { get; internal set; }
set , , , . , , .
. . , MyTask (), , true bool. , Sumlt (), , int, , .
// .
Using System;
Using System.Threading;