Exemplo n.º 1
0
        private bool TryGetValueInternal <T>(object key, bool localAtomicCompositionOnly, out T value)
        {
            for (var index = 0; index < _valueCount; index++)
            {
                if (_values[index].Key == key)
                {
                    value = (T)_values[index].Value;
                    return(true);
                }
            }

            // If there's no atomicComposition available then recurse until we hit the outermost
            // scope, where upon we go ahead and return null
            if (!localAtomicCompositionOnly && _outerAtomicComposition != null)
            {
                return(_outerAtomicComposition.TryGetValueInternal <T>(key, localAtomicCompositionOnly, out value));
            }

            value = default(T);
            return(false);
        }