I need to specifically catch SQL server timeout exceptions so that they can be handled differently. I know I could catch the SqlException and then check if the message stri
Updated for c# 6:
try { // some code } catch (SqlException ex) when (ex.Number == -2) // -2 is a sql timeout { // handle timeout }
Very simple and nice to look at!!