How could I implement my own deferred execution mechanism in C#?
So for instance I have:
string x = DoFoo();
Is it possible to perf
While it's somewhat dirty you could always use the yield keyword:
public IEnumerable DoFoo() { Console.WriteLine("doing foo"); yield return 10; } [Test] public void TestMethod() { var x = DoFoo(); Console.WriteLine("foo aquired?"); Console.WriteLine(x.First()); }