src/NetStandard/Collections/Collections/src/Specialized/IndexDirectory.cs
/// <summary>
/// Removes index entries that are in range of <paramref name="index"/> and <paramref name="index"/> + <paramref name="count"/> - 1.
/// </summary>
/// <param name="index">The beginning index.</param>
/// <param name="count">
/// The number of entries from beginning of <paramref name="index"/> that are intended to be removed. Smaller than zero leads to an
/// <see cref="ArgumentOutOfRangeException"/>.
/// </param>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is smaller than zero greater than <see cref="Count"/>.</exception>
Removes index entries that are in range of  and  +  - 1.
Removes index entries that are in range of and + - 1 .
public void Remove(int index, int count)
        {
            var indexCount = index + count;
            if (index < 0 || indexCount > virtualizableLength) {
                throw new ArgumentOutOfRangeException(nameof(index));
            }
            virtualizableLength -= count;
            var entriesListCount = entriesList.Count;
            if (index >= entriesListCount) {
                return;
            }
            var borderedIndexCount = indexCount > entriesListCount
                ? entriesListCount
                : indexCount;
            var removeRange = borderedIndexCount - index;
            int nextIndex = index;
            while (nextIndex < entriesListCount) {
                var entryList = entriesList[nextIndex];
                if (!(entryList is null)) {
                    static void decreaseEntryIndexesBy(List<IndexDirectoryEntry> entries, int amount)
                    {
                        var entriesCount = entries.Count;
                        for (var entryIndex = 0; entryIndex < entriesCount; entryIndex++) {
                            entries[entryIndex].Index -= amount;
                        }
                    }
                    decreaseEntryIndexesBy(entryList.NormalEntries, removeRange);
                    decreaseEntryIndexesBy(entryList.FloatingEntries, removeRange);
                }
                nextIndex++;
            }
            entriesList.RemoveRange(index, removeRange);
        }
public void Remove ( int index , int count ) { var indexCount = index + count ; if ( index < 0 || indexCount > virtualizableLength ) { throw new ArgumentOutOfRangeException ( nameof ( index ) ) ; } virtualizableLength -= count ; var entriesListCount = entriesList . Count ; if ( index >= entriesListCount ) { return ; } var borderedIndexCount = indexCount > entriesListCount ? entriesListCount : indexCount ; var removeRange = borderedIndexCount - index ; int nextIndex = index ; while ( nextIndex < entriesListCount ) { var entryList = entriesList [ nextIndex ] ; if ( ! ( entryList is null ) ) { static void decreaseEntryIndexesBy ( List < IndexDirectoryEntry > entries , int amount ) { var entriesCount = entries . Count ; for ( var entryIndex = 0 ; entryIndex < entriesCount ; entryIndex ++ ) { entries [ entryIndex ] . Index -= amount ; } } decreaseEntryIndexesBy ( entryList . NormalEntries , removeRange ) ; decreaseEntryIndexesBy ( entryList . FloatingEntries , removeRange ) ; } nextIndex ++ ; } entriesList . RemoveRange ( index , removeRange ) ; }
Removes index entries that are in range of  and  +  - 1.
Removes index entries that are in range of and + - 1 .
None
index
int
The beginning index.
The beginning index .
count
int
The number of entries from beginning of  that are intended to be removed. Smaller than zero leads to an
.
The number of entries from beginning of that are intended to be removed . Smaller than zero leads to an .