, . , Func FetchDocument, :
public XDocument FetchDocument(FUnc<XDocument, bool> cacheNewDocument) {
var xdoc;
lock(_lockobject) {
xdoc = Cache[_Key1];
if (xdoc == null) {
xdoc = .... Code to grab from file and add to catch - works great.....
if (cacheNewDocument(xdoc)){
Cache.Add(_Key1, xdoc)
}
else{
return xdoc;
}
}
}
return xdoc;
}
, Func , true\false, abort.
, , " () .
, , Cache . , , , . .