Lazy-Instantiation and the Lazy<T> – class

I’ve spent the last weeks playing around with MEF which uses a feature of .Net 4.0 I didn’t know before: the Lazy class. A class which gives us a standardized, easy to use and thread safe way for implementing lazy instantiation. Lazy instantiation describes a procedure of creating class instances on demand e.g. when accessing a property. The advantage is that you only invest resources like CPU time and memory if it is really necessary.

Weiterlesen »