.NET 4.0 has a nice utility class called System.Lazy that does lazy object initialization. I would like to use this class for a 3.5 project. One time I saw an implementation
public class Lazy where T : new()
{
private T value;
public bool IsValueCreated { get; private set;}
public T Value
{
get
{
if (!IsValueCreated)
{
value = new T();
IsValueCreated = true;
}
return value;
}
}
}