I would like to know if there is any class in .Net that allows me to tell it how to read a data, but that DO NOT read immediately ... only later when requested, this class it reads and stores the value, in case several readings are taken.
Something like:
var delayedDb = DelayedReader.Create(() => LerAlgoDoBancoDeDados());
var resultado = dadoDaMemoria != null ? dadoDaMemoria :
delayedDb.Read() != null ? delayedDb.Read() :
null;
To prevent me from having to do this:
var dadoDoBanco = LerAlgoDoBancoDeDados();
var resultado = dadoDaMemoria != null ? dadoDaMemoria :
dadoDoBanco != null ? dadoDoBanco :
null;