S
S
Smilley2016-11-08 15:52:39
.NET
Smilley, 2016-11-08 15:52:39

How to quickly scroll through a collection?

Good afternoon. Please help to optimize the code with the following inputs:
- there is a grid, with about 10k records of my class;
- there is a collection that stores the selected records;
- there are two variables that return the sum of the elements in the selected records:

public virtual double TotalDebet => SelectedEntries.Sum(item => item.Debet);
        public virtual double TotalCredit => SelectedEntries.Sum(item => item.Credit);

- there is a code that updates these two variables:
protected void OnSelectedEntriesChanged()
        {
            this.RaisePropertyChanged(x => x.TotalCredit);
            this.RaisePropertyChanged(x => x.TotalDebet);
        }

The problem is this:
When selecting a large number of records (with the mouse or via Ctrl + A), the collection of selected objects is not instantly replenished, but gradually, respectively, and the amounts are calculated gradually, which greatly slows down the process. I would like to clarify how it is possible to implement either a delay, or something else so that the amount is considered only after a complete update of the collection.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question