Example #1
0
        /// <summary>
        /// Return removed object or null.
        /// </summary>
        public UpdateContextSearchData?TryRemove(long chatId, int botId)
        {
            var key = UpdateContextSearchData.CreateKey(chatId, botId);

            if (_dict.TryRemove(key, out var val))
            {
                return(val);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// Return value or null.
        /// </summary>
        public UpdateContextSearchData?TryFind(long chatId, int botId)
        {
            RemoveDisposed();
            var key = UpdateContextSearchData.CreateKey(chatId, botId);

            if (_dict.TryGetValue(key, out var val))
            {
                return(val);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        public bool Contains(long chatId, int botId)
        {
            var key = UpdateContextSearchData.CreateKey(chatId, botId);

            return(_dict.ContainsKey(key));
        }