System.Lazy and System.Lazy

One of the cool new feature inside the .Net 4.0 framework is System.Lazy and System.Lazy<T>. What System.Lazy brings to the table is a way to create objects which may need to perform intensive operations and defer the execution of the operation until it is 100% absolutely needed.

Lazy initialization occurs the first time the Lazy.Value property is accessed or the Lazy.ToString() method is called.




As you can see using Lazy is easy and can be a very powerful tool in your tool chest. But like everything else, this feature of the framework is NOT meant for ever scenario, use it where it makes sense.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.