How do you use Func<> and Action<> when designing applications?

后端 未结 9 1002
情书的邮戳
情书的邮戳 2020-12-22 16:27

All the examples I can find about Func<> and Action<> are simple as in the one below where you see how they technically work but I would like

9条回答
  •  猫巷女王i
    2020-12-22 17:26

    I have a separate form that accepts a generic Func or an Action in the constructor as well as some text. It executes the Func/Action on a separate thread while displaying some text in the form and showing an animation.

    It's in my personal Util library, and I use it whenever I want to do a medium length operation and block the UI in a non-intrusive way.

    I considered putting a progress bar on the form as well, so that it could perform longer running operations but I haven't really needed it to yet.

提交回复
热议问题