示例#1
0
文件: Playlist.cs 项目: malebra/Opyum
        public void Insert(IPlaylistItem item, int index)
        {
            if (index == 0)
            {
                Items.AddFirst(item);
                return;
            }
            var temp = Items.First;

            if (index > 0)
            {
                for (int i = 0; i < index; i++)
                {
                    temp = temp.Next;
                }
                Items.AddBefore(temp, item);
                return;
            }
            throw new IndexOutOfRangeException();
        }