We have a homebrew type that we have been using since .NET 3.5 where I work that does the same thing as Lazy< T > class yet allows you to have the instance re-evaluate the Lazy Func. We would like to replace our class with the new .NET one but this Clear() or IsDirty mechanism doesn’t exist.
Is there a way to reinitialize the Lazy< T > Func method without reinstantiating the class? If not, is there a way to implement it as an extension method or is just just a bad pattern to follow in the first place?
Because it is impossible to make it thread-safe. Classes that guarantee that the programmer will shoot his leg off without any way to fix the problem don’t belong in a framework. You are free to shoot your own leg off.