If your catch block do nothing with caught exception you may declare block argument without name (to avoid warning message "CS0168: The variable 'ex' is declared but never used"):

    try

    {

        ...

    }

    catch (Exception)

    {

        // deliberately suppressing all exceptions

    }

But one day during debugging you may actually want to examine Exception. Since you don't have variable where exception is stored you can use debugger variable $exception provided by the Visual Studio.NET 2005 Debugger to examine the exception in a catch block. Just add it to Watch Window.

posted on 2008-01-15 15:38  josephshi  阅读(339)  评论(0编辑  收藏  举报