是否有投在C#中的关键字象Java? [英] Is there a throws keyword in C# like in Java?

查看:118
本文介绍了是否有投在C#中的关键字象Java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
如何使用Java风格抛出关键字在C#?

我在那里发生异常
说,例如

i have a function where an exception occurs say for example

private void functionName() throws Exception
{
   // some code that might throw an exception
}

谢谢!

推荐答案

没有,因为没有在C#中的checked异常

No, because there are no checked exceptions in C#

如果你想文档时所抛出的异常,可以使用标准的XML文档

If you are trying to document exceptions that are thrown, use the standard xml documentation

/// <exception cref="InvalidOperationException">Why it's thrown.</exception>

这篇关于是否有投在C#中的关键字象Java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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