Executing a Method Sequence

Well, I have an application that will load some data at startup; However, each method depends on the previous data collected. Therefore, I wonder how I can create such a loading sequence and wait for each method to complete asynchronously in .NET4.

NB: I know that this is easy to achieve with the async \ await.NET4.5 function, but I have to stick with .NET4 [for Windows XP users].

What I've tried so far is using delegates and events to combine methods together; However, it turned out to be very missing code.

+4
source share
2 answers

Have you tried using Task.ContinueWith?

: http://msdn.microsoft.com/en-us/library/dd537612.aspx

0

"". , , :)

- :

public static TOut Then<TIn, TOut>(this TIn obj, Func<TIn, TOut> convert)
{
  return convert(obj);
}

:

string Init();
int Convert(string str);
int Add(int i);

: Init().Then(Convert).Then(Add) .., .

-1

All Articles