using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;namespace ConsoleApplication2
{
class Program
{
static string[] eTypes ={ "none", "simple", "index", "nested idex" };
static void Main(string[] args)
{
foreach (string eType in eTypes)
{
try
{
Console.WriteLine("Main() try block reached.");//line 18
Console.WriteLine("ThrowException(\"{0}\")called.", eType);//line 19
ThrowException(eType);
Console.WriteLine("Main()try block continus.");//line 21
}
catch (System.IndexOutOfRangeException e)//line 23
{
Console.WriteLine("Main()System.IndexOutOfRangeException catch" + "bock reached.Message:\n\"{0}\"", e.Message);
}
catch//line 29
{ Console.WriteLine("Main()general catch block reached."); }
finally
{
Console.WriteLine("Main()finally block reached.");
}
Console.WriteLine();
}
}
static void ThrowException(string execptionType)
{ //line 43
Console.WriteLine("ThrowException(\"{0}\"", execptionType);
switch (execptionType)
{
case "none":
Console.WriteLine("Not throwing an exception.");
break; //line 48
case "simple":
Console.WriteLine("Throwing System.Exception.");
throw (new System.Exception()); //line 51
break;
case "index":
Console.WriteLine("Throwing System.IndexOutRangeException.");
eTypes[4] = "error"; //line 55
break;
case "nested index": try //line 58
{
Console.WriteLine("ThrowException(\"nested index\")" + "try block reached.");
Console.WriteLine("ThrowException(\"index\")called.");
ThrowException("index"); //line 63
}
catch //line 65
{
Console.WriteLine("ThrowException(\"nested index\")general" + "catch block reached.");
throw;
}
finally
{
Console.WriteLine("ThrowException(\"nested index\")finally" + "block reached."); }
break; }
}
}
}
-----------------------------------------------------------------------
ThrowException("index"); //line 63
这句是什么意思??
执行到这句以后然后执行哪里?
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;namespace ConsoleApplication2
{
class Program
{
static string[] eTypes ={ "none", "simple", "index", "nested idex" };
static void Main(string[] args)
{
foreach (string eType in eTypes)
{
try
{
Console.WriteLine("Main() try block reached.");//line 18
Console.WriteLine("ThrowException(\"{0}\")called.", eType);//line 19
ThrowException(eType);
Console.WriteLine("Main()try block continus.");//line 21
}
catch (System.IndexOutOfRangeException e)//line 23
{
Console.WriteLine("Main()System.IndexOutOfRangeException catch" + "bock reached.Message:\n\"{0}\"", e.Message);
}
catch//line 29
{ Console.WriteLine("Main()general catch block reached."); }
finally
{
Console.WriteLine("Main()finally block reached.");
}
Console.WriteLine();
}
}
static void ThrowException(string execptionType)
{ //line 43
Console.WriteLine("ThrowException(\"{0}\"", execptionType);
switch (execptionType)
{
case "none":
Console.WriteLine("Not throwing an exception.");
break; //line 48
case "simple":
Console.WriteLine("Throwing System.Exception.");
throw (new System.Exception()); //line 51
break;
case "index":
Console.WriteLine("Throwing System.IndexOutRangeException.");
eTypes[4] = "error"; //line 55
break;
case "nested index": try //line 58
{
Console.WriteLine("ThrowException(\"nested index\")" + "try block reached.");
Console.WriteLine("ThrowException(\"index\")called.");
ThrowException("index"); //line 63
}
catch //line 65
{
Console.WriteLine("ThrowException(\"nested index\")general" + "catch block reached.");
throw;
}
finally
{
Console.WriteLine("ThrowException(\"nested index\")finally" + "block reached."); }
break; }
}
}
}
-----------------------------------------------------------------------
ThrowException("index"); //line 63
这句是什么意思??
执行到这句以后然后执行哪里?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货