Like this:
Cursor.Current = Cursors.WaitCursor;
try {
. . .
} finally {
Cursor.Current = Cursors.Default;
}
or this:
try {
Cursor.Current = Cursors.WaitCursor;
. . .
} finally {
Cursor.Current = Cursors.Default;
}
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no harm in putting the first cursor assignment inside the try block. As others have noted, if you know for sure that the assignment can never throw an exception, it doesn’t strictly need to be inside the try block. If you’re not sure, it’s better to put it inside the try block.
As a general coding pattern, if you’re unsure whether a statement could throw an exception, put it inside the try block. It’s better to put it inside the try block and not need it than to assume/guess wrong and put it outside the try block when you really do need it inside.