Example #1
0
            /// <summary>
            /// Gets or sets the value at the given key.
            /// </summary>
            /// <param name="key">The key of the value to get or set.</param>
            /// <returns>The value at the given <paramref name="key"/>.</returns>
            /// <exception cref="ArgumentOutOfRangeException">The <paramref name="key"/> is not a valid defined enum value.</exception>
            public bool this[TKey key]
            {
                get
                {
                    var i = GetIndex(key);

                    if (!IsValidIndex(i))
                    {
                        throw KeyInfo <TKey> .GetInvalidKeyException(key, "key");
                    }

                    return(_buffer[i]);
                }
                set
                {
                    var i = GetIndex(key);

                    if (!IsValidIndex(i))
                    {
                        throw KeyInfo <TKey> .GetInvalidKeyException(key, "key");
                    }

                    _buffer[i] = value;
                }
            }