예제 #1
0
        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);
        }
예제 #2
0
        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;
        }