Пример #1
0
        /// <summary>
        ///     Adds an item at a specific index for a block collection.
        /// </summary>
        public static void AddAt(this BlockCollection collection, int index, Block item)
        {
            if (index == -1)
            {
                return;
            }

            if (collection.Count == 0)
            {
                collection.Add(item);
                return;
            }

            index = Math.Min(index, collection.Count - 1);

            collection.InsertAfter(collection.ElementAt(index), item);
        }