简体   繁体   English

C#中抛出异常后如何继续代码执行?

[英]How to continue code execution after the exception is thrown in C#?

How to change this code to continue app execution after the Exception is thrown?抛出异常后如何更改此代码以继续执行应用程序?

if (str is null || str == string.Empty)
{
    throw new Exception("Wrong str");
}
                    try
                    {
                        if (str is null || str == string.Empty)
                        {
                            throw new Exception("Wrong str");
                        }
                    }
                    catch (Exception strException)
                    {
                        Console.WriteLine(strException.Message);
                    }

                    //Continue......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM