Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. interface IFoo
  2. {
  3. Lazy<Task<int>> MyLazy { get; set; }
  4.  
  5. }
  6.  
  7. class Foo : IFoo
  8. {
  9. public Lazy<Task<int>> MyLazy { get; set; }
  10.  
  11. public Foo()
  12. {
  13. MyLazy = new Lazy<Task<int>>(() => /*heavy operation*/ Task.FromResult(3));
  14. }
  15.  
  16. }
  17.  
  18. public Foo()
  19. {
  20. ((IFoo)this).MyLazy = new Lazy<Task<int>>(() => /*heavy operation*/ Task.FromResult(3));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement