Пример #1
0
        internal void SetAt(uint index, object value)
        {
            IList list = JitHelpers.UnsafeCast <IList>((object)this);

            ListToBindableVectorAdapter.EnsureIndexInt32(index, list.Count);
            try
            {
                list[(int)index] = value;
            }
            catch (ArgumentOutOfRangeException ex)
            {
                throw WindowsRuntimeMarshal.GetExceptionForHR(-2147483637, (Exception)ex, "ArgumentOutOfRange_IndexOutOfRange");
            }
        }
Пример #2
0
        internal void InsertAt(uint index, object value)
        {
            IList list = JitHelpers.UnsafeCast <IList>(this);

            ListToBindableVectorAdapter.EnsureIndexInt32(index, list.Count + 1);
            try
            {
                list.Insert((int)index, value);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                ex.SetErrorCode(-2147483637);
                throw;
            }
        }
Пример #3
0
        internal void RemoveAt(uint index)
        {
            IList list = JitHelpers.UnsafeCast <IList>((object)this);

            ListToBindableVectorAdapter.EnsureIndexInt32(index, list.Count);
            try
            {
                list.RemoveAt((int)index);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                int hr = -2147483637;
                ex.SetErrorCode(hr);
                throw;
            }
        }
Пример #4
0
        internal object GetAt(uint index)
        {
            IList list = JitHelpers.UnsafeCast <IList>(this);

            ListToBindableVectorAdapter.EnsureIndexInt32(index, list.Count);
            object result;

            try
            {
                result = list[(int)index];
            }
            catch (ArgumentOutOfRangeException innerException)
            {
                throw WindowsRuntimeMarshal.GetExceptionForHR(-2147483637, innerException, "ArgumentOutOfRange_IndexOutOfRange");
            }
            return(result);
        }