1
我有这个简单的程序演示了.NET中的异常处理,在这种情况下,我正在捕获ArgumentOutOfRangeException
,但是我传递给控制台的自定义消息没有显示出来。自定义的异常消息不在控制台中显示
using System;
class program
{
static void Main()
{
int[] source = { 1, 2, 3, 4, 5 };
int[] destination = { 6, 7, 8, 9 };
try
{
Array.Copy(source, destination, 7);
}
catch (ArgumentOutOfRangeException e)
{
Console.WriteLine("Sorry, there is something wrong in the program ! : {0}", e.Message);
}
}
}
,这里是输出截图
我编辑了你的标题。请参阅:“[应该在其标题中包含”标签“](http://meta.stackexchange.com/questions/19190/)”,其中的共识是“不,他们不应该”。 –