Catch multiple exceptions at once?

前端 未结 27 2471
夕颜
夕颜 2020-11-22 11:31

It is discouraged to simply catch System.Exception. Instead, only the "known" exceptions should be caught.

Now, this sometimes leads to unnecce

27条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 12:08

    How about

    try
    {
        WebId = Guid.Empty;
        WebId = new Guid(queryString["web"]);
    }
    catch (FormatException)
    {
    }
    catch (OverflowException)
    {
    }
    

提交回复
热议问题