/// <inheritdoc />
        public bool TrySetValue(TIndex index, TValue value)
        {
            IIndexableContracts.TrySetValue(this, index);

            this.dictionary[index] = value;
            return(true);
        }
Пример #2
0
        /// <inheritdoc />
        public bool TrySetValue(TIndex index, TValue value)
        {
            IIndexableContracts.TrySetValue(this, index);

            lock (this.indexableLock)
            {
                return(this.indexable.TrySetValue(index, value));
            }
        }
        /// <inheritdoc />
        public bool TrySetValue(TIndex index, TResult value)
        {
            IIndexableContracts.TrySetValue(this, index);

            if (this.indexable.IsIndexValid(index))
            {
                this.toSourceAction(this.indexable, index, value);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <inheritdoc />
        public bool TrySetValue(TIndex index, TValue value)
        {
            IIndexableContracts.TrySetValue(this, index);

            if (this.IsIndexValid(index))
            {
                // delegate to IDictionary implementation to ensure count is maintained properly
                this[index] = value;
                return(true);
            }
            else
            {
                return(false);
            }
        }