Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Using Lazy class in C#
System namespace in .NET Framework has Lazy class that provides us with basic mechanism for lazy loads. The idea of Lazy class is simple - initialize class with action that builds or gets lazy loaded value and when value is asked then run the action if lazy loading is not happened yet.
To demonstrate Lazy class let's see the example I created once. Before running the code, go through it and try to figure out in what order messages will appear.
- Using System.Lazy (Gunnar Peipman)