如何处理“DivideByZeroException”在c#? [英] how to handle "DivideByZeroException" in c# ?

查看:78
本文介绍了如何处理“DivideByZeroException”在c#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中处理DivideByZero异常?

how to handle DivideByZero exception in c#?

推荐答案

您可以按照自己的方式处理它。没有通用规则,但你应该使用调试器来了解异常的根本原因。


你真正需要知道的是结构化异常处理一般。请看我过去的答案:

首先,这一个:是否存在例外情况C#构造函数导致调用者分配失败? [ ^ ];

以及 [ ^ ],
保持ac#windows表单应用程序运行,尽管有任何未处理的异常 [ ^ ],

当我运行一个应用程序时,会发现一个异常如何处理这个问题? [ ^ ],

扔。 .then ... rethrowing [ ^ ],

处理类库(dll)中的异常 [ ^ ],

异常详细信息:System.Runtime.InteropServices.COMException:由于以下错误,检索具有CLSID {0006F03A-0000-0000-C000-000000000046}的组件的COM类工厂失败:... [ ^ ]。



-SA
You can handle it the way you want. There are no common rules, but you should get to the root reason of the exception, using the debugger.

All you really need to know is the structured exception handling in general. Please see my past answers:
first of all, this one: Does Exception in C# Constructor Cause Caller Assignment to Fail?[^];
and also How do i make a loop that will stop when a scrollbar reaches the bottom[^],
Keep a c# windows form application running despite any unhandled exception[^],
When i run an application an exception is caught how to handle this?[^],
throw . .then ... rethrowing[^],
Handling exceptions in class library (dll)[^],
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error:...[^].

—SA


这篇关于如何处理“DivideByZeroException”在c#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆