Deferred execution in C#

前端 未结 6 2073
无人共我
无人共我 2021-01-04 07:36

How could I implement my own deferred execution mechanism in C#?

So for instance I have:

string x = DoFoo();

Is it possible to perf

6条回答
  •  醉话见心
    2021-01-04 08:08

    One option is to use the Lazy class, formerly from the parallel extensions library now a part of the .Net Framework 4.0.

    • Reference: http://msdn.microsoft.com/en-us/library/dd642331(VS.100).aspx

    It allows you to delay process data in a thread aware manner.

提交回复
热议问题