错误代码可以由名称空间中的不同类访问 [英] Error code could be accessed by different classes in a name space
本文介绍了错误代码可以由名称空间中的不同类访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想问一个关于错误代码的问题.我有一个名称空间,其中有许多类.我想捕获所有异常并将错误代码提供给它们.
我应该使用哪种结构从不同的类访问此错误结构?
错误结构将包含多个错误代码.
非常感谢您
Lilly
解决方案
我认为标准" ^ ]非常适合您的要求:它提供了您需要的所有以及更多.
本文对如何创建自定义进行了很好的描述例外: http://msdn.microsoft.com/en-us/library/ms229064.aspx [ ^ ]
您可以从此处 [ ^ ].
>
Hello,
I want to ask a question about error codes. I have a name space, and many classes inside of it. I want to catch all the exception and give error codes to them.
What kind of structure should I use to access this error structure from different classes?
The error structure will have more than one error codes.
Thank you very much
Lilly
解决方案
I suppose the ''standard'' Exception class[^] fits well with your requirements: it provides all you need and more.
This article gives a good description of how to create a custom exception: http://msdn.microsoft.com/en-us/library/ms229064.aspx[^]
You may get some good information on how to implement these custom exceptions from here[^].
这篇关于错误代码可以由名称空间中的不同类访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文