Skip to content

Commit

Permalink
remove InsertIntoSortedCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
iNoles committed Nov 20, 2024
1 parent 7bb36a3 commit a7ccfc5
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions NewsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,6 @@ await MainThread.InvokeOnMainThreadAsync(async () =>
});
}

static void InsertIntoSortedCollection<T>(ObservableCollection<T> collection, Comparison<T> comparison, T modelToInsert)
{
if (collection.Count is 0)
{
collection.Add(modelToInsert);
}
else
{
var index = 0;
foreach (var model in collection)
{
if (comparison(model, modelToInsert) >= 0)
{
collection.Insert(index, modelToInsert);
return;
}

index++;
}

collection.Insert(index, modelToInsert);
}
}

private async IAsyncEnumerable<StoryModel> GetTopStoriesAsync()
{
List<string> topStoryIds;
Expand Down

0 comments on commit a7ccfc5

Please sign in to comment.