How to write a grammar mistakes, editor undetectable, but in the process of running from the try to catch?
try
{
//not grammar mistakes
}
The catch (e)
{
//jump to here
}
CodePudding user response:
Any number of divided by zeroCodePudding user response:
Create an object, the value is null, then access to its properties, the runtime will throw NullReferenceException anomaliesCodePudding user response:
Artificial control code if you want to run the catch block of code that can be directly where needed add throw new Exception (), also can put the catch in the corresponding block in the finally (whether abnormal or not, will eventually perform), the latter is more rigorous, the former path twisted,CodePudding user response:
https://docs.microsoft.com/zh-cn/dotnet/csharp/programming-guide/exceptions/CodePudding user response:
You can throw the new DivideByZeroException (), or "throw out what else the Exception, including your custom Excption subclass object,CodePudding user response:
Throw new Exception (" you want Exception ");