Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Lazy<T> is quite useful for lazy-loading/memoization.


Yes, but cleaner syntax for it would be nice. Right now it looks quite messy:

  private Lazy<string> _someVariable =new Lazy<string>(SomeClass.IOnlyWantToCallYouOnce);
  public string SomeVariable {
    get { return _someVariable.Value; }
  }
Imagine the same things with a long lambda inside.


... and writing your own Lazy<T> with time- or otherwise-limited cache validity is not a problem, also.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: