// bool Remove(T item)
        internal bool Remove <K, V>(KeyValuePair <K, V> item)
        {
            object _this = JitHelpers.UnsafeCast <object>(this);

            IDictionary <K, V> _this_dictionary = _this as IDictionary <K, V>;

            if (_this_dictionary != null)
            {
                return(_this_dictionary.Remove(item.Key));
            }
            else
            {
                IVector <KeyValuePair <K, V> > _this_vector = JitHelpers.UnsafeCast <IVector <KeyValuePair <K, V> > >(this);
                uint index;
                bool exists = _this_vector.IndexOf(item, out index);

                if (!exists)
                {
                    return(false);
                }

                if (((uint)Int32.MaxValue) < index)
                {
                    throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
                }

                VectorToListAdapter.RemoveAtHelper <KeyValuePair <K, V> >(_this_vector, index);
                return(true);
            }
        }
        // bool Remove(T item)
        internal bool Remove <K, V>(KeyValuePair <K, V> item)
        {
            object _this = Unsafe.As <object>(this);

            if (_this is IDictionary <K, V> _this_dictionary)
            {
                return(_this_dictionary.Remove(item.Key));
            }
            else
            {
                IVector <KeyValuePair <K, V> > _this_vector = Unsafe.As <IVector <KeyValuePair <K, V> > >(this);
                uint index;
                bool exists = _this_vector.IndexOf(item, out index);

                if (!exists)
                {
                    return(false);
                }

                if (((uint)int.MaxValue) < index)
                {
                    throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
                }

                VectorToListAdapter.RemoveAtHelper <KeyValuePair <K, V> >(_this_vector, index);
                return(true);
            }
        }
        // bool Contains(T item)
        internal bool Contains <K, V>(KeyValuePair <K, V> item)
        {
            object _this = JitHelpers.UnsafeCast <object>(this);

            IDictionary <K, V> _this_dictionary = _this as IDictionary <K, V>;

            if (_this_dictionary != null)
            {
                V    value;
                bool hasKey = _this_dictionary.TryGetValue(item.Key, out value);

                if (!hasKey)
                {
                    return(false);
                }

                return(EqualityComparer <V> .Default.Equals(value, item.Value));
            }
            else
            {
                IVector <KeyValuePair <K, V> > _this_vector = JitHelpers.UnsafeCast <IVector <KeyValuePair <K, V> > >(this);

                uint index;
                return(_this_vector.IndexOf(item, out index));
            }
        }
        internal bool Contains <T>(T item)
        {
            IVector <T> vector = JitHelpers.UnsafeCast <IVector <T> >(this);
            uint        num;

            return(vector.IndexOf(item, out num));
        }
        // bool Contains(T item)
        internal bool Contains <T>(T item)
        {
            IVector <T> _this = Unsafe.As <IVector <T> >(this);

            uint index;

            return(_this.IndexOf(item, out index));
        }
        // bool Contains(T item)
        internal bool Contains <T>(T item)
        {
            IVector <T> _this = JitHelpers.UnsafeCast <IVector <T> >(this);

            uint index;

            return(_this.IndexOf(item, out index));
        }
        internal bool Contains <K, V>(KeyValuePair <K, V> item)
        {
            object             obj        = JitHelpers.UnsafeCast <object>(this);
            IDictionary <K, V> dictionary = obj as IDictionary <K, V>;

            if (dictionary != null)
            {
                V x;
                return(dictionary.TryGetValue(item.Key, out x) && EqualityComparer <V> .Default.Equals(x, item.Value));
            }
            IVector <KeyValuePair <K, V> > vector = JitHelpers.UnsafeCast <IVector <KeyValuePair <K, V> > >(this);
            uint num;

            return(vector.IndexOf(item, out num));
        }
Beispiel #8
0
        internal int IndexOf <T>(T item)
        {
            IVector <T> vector = JitHelpers.UnsafeCast <IVector <T> >(this);
            uint        num;

            if (!vector.IndexOf(item, out num))
            {
                return(-1);
            }
            if (2147483647U < num)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
            }
            return((int)num);
        }
Beispiel #9
0
        internal bool Remove <T>(T item)
        {
            IVector <T> _this = JitHelpers.UnsafeCast <IVector <T> >((object)this);
            uint        index;

            if (!_this.IndexOf(item, out index))
            {
                return(false);
            }
            if ((uint)int.MaxValue < index)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
            }
            VectorToListAdapter.RemoveAtHelper <T>(_this, index);
            return(true);
        }
        internal bool Remove <T>(T item)
        {
            IVector <T> vector = JitHelpers.UnsafeCast <IVector <T> >(this);
            uint        num;

            if (!vector.IndexOf(item, out num))
            {
                return(false);
            }
            if (2147483647U < num)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
            }
            VectorToListAdapter.RemoveAtHelper <T>(vector, num);
            return(true);
        }
        // int IndexOf(T item)
        internal int IndexOf <T>(T item)
        {
            IVector <T> _this = Unsafe.As <IVector <T> >(this);

            bool exists = _this.IndexOf(item, out uint index);

            if (!exists)
            {
                return(-1);
            }

            if (((uint)int.MaxValue) < index)
            {
                throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
            }

            return((int)index);
        }
Beispiel #12
0
        // bool Remove(T item)
        internal bool Remove <T>(T item)
        {
            IVector <T> _this = Unsafe.As <IVector <T> >(this);

            bool exists = _this.IndexOf(item, out uint index);

            if (!exists)
            {
                return(false);
            }

            if (((uint)int.MaxValue) < index)
            {
                throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
            }

            VectorToListAdapter.RemoveAtHelper <T>(_this, index);
            return(true);
        }
Beispiel #13
0
        internal int IndexOf <T>(T item)
        {
            IVector <T> _this = JitHelpers.UnsafeCast <IVector <T> >(this);

            uint index;
            bool exists = _this.IndexOf(item, out index);

            if (!exists)
            {
                return(-1);
            }

            if (((uint)Int32.MaxValue) < index)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
            }

            return((int)index);
        }
Beispiel #14
0
        // bool Contains(T item)
        internal bool Contains <K, V>(KeyValuePair <K, V> item) where K : notnull
        {
            object _this = Unsafe.As <object>(this);

            if (_this is IDictionary <K, V> _this_dictionary)
            {
                bool hasKey = _this_dictionary.TryGetValue(item.Key, out V value);

                if (!hasKey)
                {
                    return(false);
                }

                return(EqualityComparer <V> .Default.Equals(value, item.Value));
            }
            else
            {
                IVector <KeyValuePair <K, V> > _this_vector = Unsafe.As <IVector <KeyValuePair <K, V> > >(this);

                return(_this_vector.IndexOf(item, out _));
            }
        }
Beispiel #15
0
        internal bool Remove <K, V>(KeyValuePair <K, V> item)
        {
            IDictionary <K, V> dictionary = JitHelpers.UnsafeCast <object>((object)this) as IDictionary <K, V>;

            if (dictionary != null)
            {
                return(dictionary.Remove(item.Key));
            }
            IVector <KeyValuePair <K, V> > _this = JitHelpers.UnsafeCast <IVector <KeyValuePair <K, V> > >((object)this);
            uint index;

            if (!_this.IndexOf(item, out index))
            {
                return(false);
            }
            if ((uint)int.MaxValue < index)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
            }
            VectorToListAdapter.RemoveAtHelper <KeyValuePair <K, V> >(_this, index);
            return(true);
        }
        internal bool Remove <K, V>(KeyValuePair <K, V> item)
        {
            object             obj        = JitHelpers.UnsafeCast <object>(this);
            IDictionary <K, V> dictionary = obj as IDictionary <K, V>;

            if (dictionary != null)
            {
                return(dictionary.Remove(item.Key));
            }
            IVector <KeyValuePair <K, V> > vector = JitHelpers.UnsafeCast <IVector <KeyValuePair <K, V> > >(this);
            uint num;

            if (!vector.IndexOf(item, out num))
            {
                return(false);
            }
            if (2147483647U < num)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
            }
            VectorToListAdapter.RemoveAtHelper <KeyValuePair <K, V> >(vector, num);
            return(true);
        }