[英]See reason why an Exception can be thrown (documentation)
我有这个示例方法:
/// <summary>
/// Method to enforce that the type is an Enum.
/// </summary>
/// <typeparam name="T"> Type.</typeparam>
/// <exception cref="ArgumentException"> Thrown when type is not an Enum type. </exception>
public static void TypeIsEnum<T>(T type)
{
if (!typeof(T).IsEnum)
{
throw new ArgumentException();
}
}
当我在Visual Studio中将鼠标悬停在此方法上时,智能感知会向我显示一些额外的信息,如下所示。
尽管我记录了TypeIsEnum
方法可以引发的exception
类型,并给出了引发异常的明确原因,但它并未在Intellisense中显示出原因。 如何显示为什么可以在Intellisense中引发exception
的原因?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.