✅ Is use of IDisposable, using keyword for a UI wait indicator incorrect?
I have a wait indicator for WPF that implements
This is the code I used before implementing
Here I have an early return, so I have to call
On the other hand, using this code:
Seems more simplistic and readable. I am wondering if there are any problems with this. If so, are there any alternatives to this?
Thanks!
IDisposable. When creating a new object of this IDisposasble implementation wrapped in a using keyword, it initializes the wait indicator on my WPF screen. Upon disposing, the wait indicator disappears.This is the code I used before implementing
IDisposable:Here I have an early return, so I have to call
waiter.hide() twice. This is a simple case, so it may seem trivial to call it more than once, but this can cause problems when the code is more complicated. Forgetting to hide() will obviously hang the UI.On the other hand, using this code:
Seems more simplistic and readable. I am wondering if there are any problems with this. If so, are there any alternatives to this?
Thanks!


