Dumpify icon indicating copy to clipboard operation
Dumpify copied to clipboard

Support for progress bar

Open latop2604 opened this issue 1 year ago • 3 comments

It would be very nice if this lib have an extensions method for enumerable that display a dynamic progressbar.

var list = new List<int> {1,2,3,4};
foreach(var i un list.WithProgess("Caption"))
{
    // Do slow stuff
}

latop2604 avatar Oct 02 '23 13:10 latop2604

Hi @latop2604, thanks for the suggestion! :)

"Live" controls are in my roadmap, but I think I'll need some time (and suggestions from the community) while tinkering with Progress Bars for Dumpify.

For example, IEnumerable<T> and IAsyncEnumerable<T> don't have a notion of Count, therefore I wouldn't be able to know the current status. Also, we could have infinite IEnumerable<T> and IAsyncEnumerable<T>, without us knowing about it beforehand. We could though implement it for everything ICollection<T> which does have a Count property, but ICollection<T> is not lazy, so I'm not sure that this feature is needed in that situation.

What do you think? :)

MoaidHathot avatar Oct 05 '23 00:10 MoaidHathot

On my side I still use IEnumerable<T> but throw when we don't have the size.

They are many ways to get it from an IEnumerable. They more or less listed in the linq Count extension method (see screenshot below).

We can aslo use the extension method TryGetNonEnumeratedCount. But only for net 6+

The concern I have for this feature is where the progressbar will be displayed. I'm used to LinqPad where you can have many progressbar active and you can scroll the view to see each of them. But I don't know if it's possible with spectre.

image

For not countable list or asyncenumerable we can use undeterminated state progressbar. But I don't see the value of having it.

latop2604 avatar Oct 05 '23 08:10 latop2604

Sorry for the delay in my response. Using a Progress Bar requires Live Display. Those are in the roadmap, I have a few ideas for Live Display as well, and your idea about Progress can be part of them. Let's discuss this Issue when we reach that point, I'm planning to do under the hood changes that will help us integrate Live Display.

MoaidHathot avatar Oct 13 '23 12:10 MoaidHathot