Exemplo n.º 1
0
        /// <summary>
        /// Gets the value by its key.
        /// </summary>
        /// <param name="key">The key</param>
        /// <returns>The value corresponding to the given key</returns>
        public TValue Get(TKey key)
        {
            var  binaryKey = _keySerializer.Serialize(key);
            bool isFullMatch;

            IRadixTreeNode node = FindMostSuitableNode(binaryKey, out _, out _, out isFullMatch /*, treeNode => references.Add(treeNode.Reference)*/);

            if (isFullMatch)
            {
                if (node.ValueReference != null)
                {
                    return(_valueStorage.Fetch(node.ValueReference));
                }
            }

            return(default(TValue));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the value by its key.
        /// </summary>
        /// <param name="key">The key</param>
        /// <returns>The value corresponding to the given key</returns>
        public TValue Get(TKey key)
        {
            var entry = FindSuitableEntry(key);

            return(entry.HasValue ? _valueStorage.Fetch(entry.Value.Value) : default(TValue));
        }