C# 遇到错误 回到0

来源:百度知道 编辑:UC知道 时间:2024/06/06 00:41:18
在ASP里面有On Error Goto 0
我想知道在C#里面哪句话也表示相同的意思,最好举例说明整个回滚过程
谢谢
一定加分

int x = 200, y = 4;
int count = 0;
string[,] array = new string[x, y];

// Initialize the array:
for (int i = 0; i < x; i++)

for (int j = 0; j < y; j++)
array[i, j] = (++count).ToString();

// Read input:
Console.Write("Enter the number to search for: ");

// Input a string:
string myNumber = Console.ReadLine();

// Search:
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
if (array[i, j].Equals(myNumber))
{
goto Found;
}
}
}

Console.WriteLine("The number {0} was not found.", myNumber);
goto Finish;

Found:
Console.WriteLine("