Exemplo n.º 1
0
        /// <summary>
        /// Resize the list. Internal call only!!
        /// </summary>
        public static void Resize <T>(this AppendOnlyList <T> list, int count)
        {
            if (count > list.Items.Length)
            {
                Array.Resize(ref list.Items, count);
            }

            // TODO: Shrink list if count < (Items.Length / 2)?

            list.Count = count;
        }
Exemplo n.º 2
0
        public static void ShallowCopyTo <T>(this AppendOnlyList <T> source, AppendOnlyList <T> dest)
            where T : struct
        {
            if (dest.Items.Length < source.Count)
            {
                Array.Resize(ref dest.Items, source.Count);
            }

            Array.Copy(source.Items, dest.Items, source.Count);
            dest.Count = source.Count;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Resets count to 0.
 /// </summary>
 public static void Clear <T>(this AppendOnlyList <T> list)
 {
     list.Count = 0;
 }