A JustInTime class
Saturday, August 30th, 2008I discovered in my code a redundant pattern :
private SomeType _something;
private SomeType something { get { if (_something == null) _something = new SomeType(….); return _something;} }
Usefull in Silverlight, when your Blender always say “Can’t compile ! Strange errors ! but compiles when i comment your WebClient… in ctor of that class…”
So i use it to have members builded the first time they are used, “Just in time”.
/!\ It’s not a Singleton ! i can have others instance of this class new-ing it directly !
/!\ Singleton is Evil // feed the Troll