C# equivalent to VB.NET Catch ... When

Posted by fung on Stack Overflow See other posts from Stack Overflow or by fung
Published on 2008-10-08T03:04:59Z Indexed on 2010/05/19 18:20 UTC
Read the original article Hit count: 248

Filed under:
|
|

In VB.NET I often Catch ... When ...

Try
  ' Some code'
Catch e As ArgumentNullException When e.ParamName.ToUpper() = "SAMPLES"
  ' Handle the error'
End Try

Is there a C# equivalent to Catch ... When?

I don't want to resort to using an if statement inside a catch if possible.

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb.net