Deferred execution in C#

前端 未结 6 2057
无人共我
无人共我 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-04 07:43

    Why not just not call 'DoFoo()' until you want to?

    -- Edit

    I mean, what do you mean "use"

    For example, if you want it to be called when '.ToString()' called, you can always inherit the class and implement your function there (but this would be quite unintuitive IMHO).

提交回复
热议问题