Ejemplo n.º 1
0
        private static uint GetManyHelper <T>(IList <T> sourceList, uint startIndex, T[] items)
        {
            if ((long)startIndex == (long)sourceList.Count)
            {
                return(0);
            }
            ListToVectorAdapter.EnsureIndexInt32(startIndex, sourceList.Count);
            if (items == null)
            {
                return(0);
            }
            uint num = Math.Min((uint)items.Length, (uint)sourceList.Count - startIndex);

            for (uint index = 0; index < num; ++index)
            {
                items[(int)index] = sourceList[(int)index + (int)startIndex];
            }
            if (typeof(T) == typeof(string))
            {
                string[] strArray = items as string[];
                for (uint index = num; (long)index < (long)items.Length; ++index)
                {
                    strArray[(int)index] = string.Empty;
                }
            }
            return(num);
        }
        // Token: 0x06006324 RID: 25380 RVA: 0x00151258 File Offset: 0x0014F458
        private static uint GetManyHelper <T>(IList <T> sourceList, uint startIndex, T[] items)
        {
            if ((ulong)startIndex == (ulong)((long)sourceList.Count))
            {
                return(0U);
            }
            ListToVectorAdapter.EnsureIndexInt32(startIndex, sourceList.Count);
            if (items == null)
            {
                return(0U);
            }
            uint num = Math.Min((uint)items.Length, (uint)(sourceList.Count - (int)startIndex));

            for (uint num2 = 0U; num2 < num; num2 += 1U)
            {
                items[(int)num2] = sourceList[(int)(num2 + startIndex)];
            }
            if (typeof(T) == typeof(string))
            {
                string[] array = items as string[];
                uint     num3  = num;
                while ((ulong)num3 < (ulong)((long)items.Length))
                {
                    array[(int)num3] = string.Empty;
                    num3            += 1U;
                }
            }
            return(num);
        }
Ejemplo n.º 3
0
        internal void SetAt <T>(uint index, T value)
        {
            IList <T> objList = JitHelpers.UnsafeCast <IList <T> >((object)this);

            ListToVectorAdapter.EnsureIndexInt32(index, objList.Count);
            try
            {
                objList[(int)index] = value;
            }
            catch (ArgumentOutOfRangeException ex)
            {
                throw WindowsRuntimeMarshal.GetExceptionForHR(-2147483637, (Exception)ex, "ArgumentOutOfRange_IndexOutOfRange");
            }
        }
        internal void InsertAt <T>(uint index, T value)
        {
            IList <T> list = JitHelpers.UnsafeCast <IList <T> >(this);

            ListToVectorAdapter.EnsureIndexInt32(index, list.Count + 1);
            try
            {
                list.Insert((int)index, value);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                ex.SetErrorCode(-2147483637);
                throw;
            }
        }
Ejemplo n.º 5
0
        internal void RemoveAt <T>(uint index)
        {
            IList <T> objList = JitHelpers.UnsafeCast <IList <T> >((object)this);

            ListToVectorAdapter.EnsureIndexInt32(index, objList.Count);
            try
            {
                objList.RemoveAt((int)index);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                int hr = -2147483637;
                ex.SetErrorCode(hr);
                throw;
            }
        }
        internal T GetAt <T>(uint index)
        {
            IList <T> list = JitHelpers.UnsafeCast <IList <T> >(this);

            ListToVectorAdapter.EnsureIndexInt32(index, list.Count);
            T result;

            try
            {
                result = list[(int)index];
            }
            catch (ArgumentOutOfRangeException innerException)
            {
                throw WindowsRuntimeMarshal.GetExceptionForHR(-2147483637, innerException, "ArgumentOutOfRange_IndexOutOfRange");
            }
            return(result);
        }
Ejemplo n.º 7
0
 internal uint GetMany <T>(uint startIndex, T[] items)
 {
     return(ListToVectorAdapter.GetManyHelper <T>(JitHelpers.UnsafeCast <IList <T> >((object)this), startIndex, items));
 }
        internal uint GetMany <T>(uint startIndex, T[] items)
        {
            IList <T> sourceList = JitHelpers.UnsafeCast <IList <T> >(this);

            return(ListToVectorAdapter.GetManyHelper <T>(sourceList, startIndex, items));
        }