Posted By: Phil Pennington | Nov 3rd @ 10:48 AM | 23,589 Views | 10 Comments
Join Josh and Steve as they demonstrate how to use the new .NET4 Lazy<T> class in optimized object initialization scenarios.

Lazy<T> is one of many new thread-safe data-structures available with .NET4 and Visual Studio 2010.

Learn more about the System.Collections.Concurrent namespace and keep abreast of Parallel Computing tools and techniques via the Concurrency Dev Center.

See all videos in this series.

Rating:
2
0

Hi aL_,

 

Lazy<T,TMetadata> actually extends Lazy<T> and no it won't end up in BCL, for Beta 2, it's actually in System.ComponentModel.Composition.  We'd considered the implicit cast operator but because we're executing arbitrary code we determined that's a bad idea.  It's only complicated by the fact that the valueFactory delegate may thrown an exception.

 

Thanks for the feedback!

 

Josh

Microsoft Communities