C# - 6 - Long operations.

[C# 2.0]

During long operations the user usually likes to see some sort of indication that all is well. This is typically achieved by replacing the cursor with an hourglass (or similar icon depending on theme settings). To achieve this in your C# code first add the following class to your project …

and then use like this …

This will set the cursor to the hourglass symbol, perform the operation, and then return the cursor to its original symbol at the end. The using command means the HourglassCursor() class will be automatically disposed of … which is where the cursor reset occurs.


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License