public void TryGetValue_True() { int?value; Assert.That(_store.TryGetValue("a", out value)); Assert.That(value, Is.EqualTo(1)); }
public bool TryGetValue(TKey key, out TValue value) { ArgumentUtility.CheckNotNull("key", key); RemoveExpiredItems(); Tuple <TValue, TExpirationInfo> valueResult; if (_innerDataStore.TryGetValue(key, out valueResult)) { if (!_expirationPolicy.IsExpired(valueResult.Item1, valueResult.Item2)) { value = valueResult.Item1; return(true); } RemoveWithoutScanning(key); } value = default(TValue); return(false); }
public bool TryGetValue(TKey key, out TValue value) { ArgumentUtility.DebugCheckNotNull("key", key); return(_dataStore.TryGetValue(key, out value)); }