private static void FillIndex <TIndexKey>(IIndex <TIndexKey, int> index, [NotNull] FastCollection <TRaw> fastCollection, [NotNull] Func <TRaw, TIndexKey> selector) { var indexData = new List <IndexItem <TIndexKey, int> >(); foreach (var item in fastCollection.Items) { indexData.Add(new IndexItem <TIndexKey, int>(selector(item.Data), item.Id)); } index.FillIndex(indexData); }