internal int Add(object value)
        {
            IBindableVector _this = JitHelpers.UnsafeCast <IBindableVector>(this);

            _this.Append(value);

            uint size = _this.Size;

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

            return((int)(size - 1));
        }
        bool IBindableVector.IndexOf(object value, out uint index)
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                return(bindableVector.IndexOf(value, out index));
            }
            else
            {
                // IBindableVector -> IVector<T>
                return(GetVectorOfT().IndexOf(ConvertTo <T1>(value), out index));
            }
        }
        void IBindableVector.SetAt(uint index, object value)
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                bindableVector.SetAt(index, value);
            }
            else
            {
                // IBindableVector -> IVector<T>
                GetVectorOfT().SetAt(index, ConvertTo <T1>(value));
            }
        }
        object IBindableVector.GetAt(uint index)
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                return(bindableVector.GetAt(index));
            }
            else
            {
                // IBindableVector -> IVector<T>
                return(GetVectorOfT().GetAt(index));
            }
        }
        IBindableVectorView IBindableVector.GetView()
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                return(bindableVector.GetView());
            }
            else
            {
                // IBindableVector -> IVector<T>
                return(new IVectorViewToIBindableVectorViewAdapter <T1>(GetVectorOfT().GetView()));
            }
        }
Esempio n. 6
0
        void IBindableVector.Clear()
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                bindableVector.Clear();
            }
            else
            {
                // IBindableVector -> IVector<T>
                GetVectorOfT().Clear();
            }
        }
Esempio n. 7
0
        void IBindableVector.RemoveAtEnd()
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                bindableVector.RemoveAtEnd();
            }
            else
            {
                // IBindableVector -> IVector<T>
                GetVectorOfT().RemoveAtEnd();
            }
        }
Esempio n. 8
0
        void IBindableVector.Append(object value)
        {
            IBindableVector bindableVector = GetIBindableVectorNoThrow();

            if (bindableVector != null)
            {
                // IBindableVector -> IBindableVector
                bindableVector.Append(value);
            }
            else
            {
                // IBindableVector -> IVector<T>
                GetVectorOfT().Append(ConvertTo <T1>(value));
            }
        }
        // int Add(object value)
        internal int Add(object value)
        {
            IBindableVector _this = Unsafe.As <IBindableVector>(this);

            _this.Append(value);

            uint size = _this.Size;

            if (((uint)Int32.MaxValue) < size)
            {
                throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
            }

            return((int)(size - 1));
        }
        // bool Remove(object item)
        internal void Remove(object item)
        {
            IBindableVector _this = Unsafe.As <IBindableVector>(this);

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

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

                RemoveAtHelper(_this, index);
            }
        }
Esempio n. 11
0
        internal void Remove(object item)
        {
            IBindableVector _this = JitHelpers.UnsafeCast <IBindableVector>(this);

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

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

                RemoveAtHelper(_this, index);
            }
        }
        // int IndexOf(object item)
        internal int IndexOf(object item)
        {
            IBindableVector _this = Unsafe.As <IBindableVector>(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);
        }
Esempio n. 13
0
        // Token: 0x06006339 RID: 25401 RVA: 0x001515C8 File Offset: 0x0014F7C8
        private static object GetAt(IBindableVector _this, uint index)
        {
            object at;

            try
            {
                at = _this.GetAt(index);
            }
            catch (Exception ex)
            {
                if (-2147483637 == ex._HResult)
                {
                    throw new ArgumentOutOfRangeException("index");
                }
                throw;
            }
            return(at);
        }
        private static void RemoveAtHelper(IBindableVector _this, uint index)
        {
            try
            {
                _this.RemoveAt(index);

                // We delegate bounds checking to the underlying collection and if it detected a fault,
                // we translate it to the right exception:
            }
            catch (Exception ex)
            {
                if (HResults.E_BOUNDS == ex.HResult)
                {
                    throw new ArgumentOutOfRangeException(nameof(index));
                }

                throw;
            }
        }
Esempio n. 15
0
        private static void InsertAtHelper(IBindableVector _this, uint index, object item)
        {
            try
            {
                _this.InsertAt(index, item);

                // We delegate bounds checking to the underlying collection and if it detected a fault,
                // we translate it to the right exception:
            }
            catch (Exception ex)
            {
                if (__HResults.E_BOUNDS == ex._HResult)
                {
                    throw new ArgumentOutOfRangeException("index");
                }

                throw;
            }
        }
Esempio n. 16
0
        // Helpers:

        private static object GetAt(IBindableVector _this, uint index)
        {
            try
            {
                return(_this.GetAt(index));

                // We delegate bounds checking to the underlying collection and if it detected a fault,
                // we translate it to the right exception:
            }
            catch (Exception ex)
            {
                if (__HResults.E_BOUNDS == ex._HResult)
                {
                    throw new ArgumentOutOfRangeException(nameof(index));
                }

                throw;
            }
        }
        private static void RemoveAtHelper(IBindableVector _this, uint index)
        {
            try
            {
                _this.RemoveAt(index);

                // We delegate bounds checking to the underlying collection and if it detected a fault,
                // we translate it to the right exception:
            }
            catch (Exception ex)
            {
                if (__HResults.E_BOUNDS == ex._HResult)
                    throw new ArgumentOutOfRangeException("index");

                throw;
            }
        }
        // void Clear()
        internal void Clear()
        {
            IBindableVector _this = Unsafe.As <IBindableVector>(this);

            _this.Clear();
        }
        // bool Contains(object item)
        internal bool Contains(object item)
        {
            IBindableVector _this = Unsafe.As <IBindableVector>(this);

            return(_this.IndexOf(item, out _));
        }
Esempio n. 20
0
        internal void Clear()
        {
            IBindableVector _this = JitHelpers.UnsafeCast <IBindableVector>(this);

            _this.Clear();
        }
Esempio n. 21
0
        internal void Clear()
        {
            IBindableVector bindableVector = JitHelpers.UnsafeCast <IBindableVector>(this);

            bindableVector.Clear();
        }
        private static void SetAt(IBindableVector _this, uint index, object value)
        {
            try
            {
                _this.SetAt(index, value);

                // We delegate bounds checking to the underlying collection and if it detected a fault,
                // we translate it to the right exception:
            }
            catch (Exception ex)
            {
                if (__HResults.E_BOUNDS == ex._HResult)
                    throw new ArgumentOutOfRangeException(nameof(index));

                throw;
            }
        }