FindDeletedMetadataIndexFinder.cs 512 B

1234567891011121314151617
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Best.HTTP.Shared.Databases.MetadataIndexFinders
  4. {
  5. public sealed class FindDeletedMetadataIndexFinder<MetadataType> : IEmptyMetadataIndexFinder<MetadataType> where MetadataType : Metadata
  6. {
  7. public int FindFreeIndex(List<MetadataType> metadatas)
  8. {
  9. for (int i = 0; i < metadatas.Count; ++i)
  10. if (metadatas[i].IsDeleted)
  11. return i;
  12. return metadatas.Count;
  13. }
  14. }
  15. }