diff --git a/ClosedXML/Excel/Caching/XLRepositoryBase.cs b/ClosedXML/Excel/Caching/XLRepositoryBase.cs
index 596dacf..5d2c5fe 100644
--- a/ClosedXML/Excel/Caching/XLRepositoryBase.cs
+++ b/ClosedXML/Excel/Caching/XLRepositoryBase.cs
@@ -31,17 +31,34 @@
_createNew = createNew;
}
- public bool ContainsKey(Tkey key)
+ ///
+ /// Check if the specified key is presented in the repository.
+ ///
+ /// Key to look for.
+ /// Value from the repository stored under specified key or null if key does
+ /// not exist or the entry under this key has already bee GCed.
+ /// True if entry exists and alive, false otherwise.
+ public bool ContainsKey(Tkey key, out Tvalue value)
{
WeakReference cachedReference;
if (_storage.TryGetValue(key, out cachedReference))
{
- var storedValue = cachedReference.Target as Tvalue;
- return (storedValue != null);
+ value = cachedReference.Target as Tvalue;
+ return (value != null);
}
+ value = null;
return false;
}
+ ///
+ /// Put the entity into the repository under the specified key if no other entity with
+ /// the same key is presented.
+ ///
+ /// Key to identify the entity.
+ /// Entity to store.
+ /// Entity that is stored in the repository under the specified key
+ /// (it can be either the or another entity that has been added to
+ /// the repository before.)
public Tvalue Store(Tkey key, Tvalue value)
{
if (value == null)
@@ -65,6 +82,10 @@
}
}
+ ///
+ /// Create a new entity using specified key and put it into the repository or
+ /// return the existing entity ith this key.
+ ///
public Tvalue GetOrCreate(Tkey key)
{
WeakReference cachedReference;