src/NetStandard/Collections/Collections/src/Specialized/IndexDirectory.cs
/// <summary>
/// Removes all null and empty lists at the end of
/// this index directory.
/// </summary>
Removes all null and empty lists at the end of
this index directory.
Removes all null and empty lists at the end of this index directory .
public void TrimEnd()
        {
            var entryListsCount = entriesList.Count;
            var lastIndex = entryListsCount;
            for (var index = entryListsCount - 1; index >= 0; index--) {
                var entries = entriesList[index];
                if (entries is null || (entries.NormalEntries.Count == 0 && entries.FloatingEntries.Count == 0)) {
                    lastIndex = index;
                } else {
                    break;
                }
            }
            virtualizableLength = lastIndex;
            if (lastIndex >= entryListsCount) {
                return;
            }
            entriesList.RemoveRange(lastIndex, entryListsCount - lastIndex);
            entriesList.TrimExcess();
        }
public void TrimEnd ( ) { var entryListsCount = entriesList . Count ; var lastIndex = entryListsCount ; for ( var index = entryListsCount - 1 ; index >= 0 ; index -- ) { var entries = entriesList [ index ] ; if ( entries is null || ( entries . NormalEntries . Count == 0 && entries . FloatingEntries . Count == 0 ) ) { lastIndex = index ; } else { break ; } } virtualizableLength = lastIndex ; if ( lastIndex >= entryListsCount ) { return ; } entriesList . RemoveRange ( lastIndex , entryListsCount - lastIndex ) ; entriesList . TrimExcess ( ) ; }
Removes all null and empty lists at the end of
this index directory.
Removes all null and empty lists at the end of this index directory .