Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagec#
themeEmacs
//Labda
Func<int, int> F1 = x => x + 1;
Func<int, int> F2 = x => x + 1;
Func<int, int> F3 = x => x + 1;
Func<int, int, int> F4 = delegate ( int x, int y ){
     return x + y;
};            

//Block with task
Task<int> futureBfutureA = Task.Factory.StartNew<int>(() => F1(1));
int c = F2(1);
int d = F3(c);
int f = F4(futureA.Result, d);
Console.WriteLine("ResultA:" + f);

//Continuation Tasks
var futureB = Task.Factory.StartNew<int>(() => F1(1));
var futureD = Task.Factory.StartNew<int>(() => F3(F2(1)));
var futureF = Task.Factory.ContinueWhenAll<int, int>(
                 new[] { futureB, futureD },
                 ( tasks ) => F4(futureB.Result, dfutureD.Result));

futureF.ContinueWith(( t ) =>
    Console.WriteLine("ResultF:" + t.Result)
);

Console.WriteLine("Code...End");


Promice (미래를 위한 약속)

퓨쳐가 읽기전용 용기라고하면, 퓨쳐자체를 반환하는것을 작성하고 싶을때는 Promice를 사용하면 됩니다.

...