I can suggest my today's discovery for estimating the seconds left in a 3 minutes process in C#.
Anyone better approach?
Stopwatchsw;longtotaltime=0;// counts the total time passed in millisecondsintsecondsleft;// estimated time leftinti=0;// counter in the foreach loop// objList has couple of hundred elements//secondsleft is recalculated after each iterationforeach(varobjinobjList){sw=Stopwatch.StartNew();//some time consuming process herei++;totaltime=totaltime+sw.ElapsedMilliseconds;secondsleft=(int)Math.Floor((double)totaltime/i/1000*(objList.Count()-i));}
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse