public bool TryGetItem(CountryKind country, string stockId, out ICurrentPrice item) { string stockFullId = $"{country.GetShortName()}.{stockId}"; if (_storage.TryGetValue(stockFullId, out ICurrentPrice target)) { item = target; return(true); } item = null; return(false); }
public void AddOrUpdateItem(CountryKind country, string stockId, ICurrentPrice item) { string stockFullId = $"{country.GetShortName()}.{stockId}"; if (_storage.ContainsKey(stockFullId) && _storage[stockFullId] == item) { return; } _storage[stockFullId] = item; IsAddedOrUpdated = true; }