How to make the cleanest code when reporting progress to a user?

后端 未结 13 1486
失恋的感觉
失恋的感觉 2021-02-08 09:10

I\'ve struggled for the last couple of months to come up with some clean code to report progress to a user. Everything always seems to boil down to:

ReportProgr         


        
13条回答
  •  暖寄归人
    2021-02-08 09:50

    I wouldn't hand-code the numeric parts of the displayed messages like that (any time you need to add or remove actions or change the sequence you've got a mess of cut-and-paste to do). You'd want whatever object is handling the ReportProgress method to auto-increment itself as it goes along.

提交回复
热议问题