© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
4 replies
Relevant

❔ ✅ Best practice for tracking progress for long running method

I am creating a Blazor Server application. I have a method that is compiling some data from a few servers. I'd like to show some sort of progress bar to show the user approximately how much is left. Currently the method just returns a List of all of the objects that was compiled during the process. This is being done in a service class, so I wouldn't have access to the UI elements from the method.

So is there a way to send progress information back to the caller periodically?

I could refactor the method to do 1 server at a time, that way I'll know, for example, that it's 3 of 8 completed, etc. And I could break it down even further to split apart each section of processing to get even more granular. But that seems like it could be more work than it's worth for just a UI nicety. Is there some super neat way of doing this better?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Cancel long running task/method
C#CC# / help
2y ago
Best practice for class constructors?
C#CC# / help
2y ago
❔ best design practice for this?
C#CC# / help
4y ago